Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
{} vs new Object() vs Object.null (Assignment)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Browser:
Chrome 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
{}
14576.4 Ops/sec
new Object()
14861.9 Ops/sec
Object.create(null)
16189.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const SIZE = 1000; const _floor = Math.floor; const _random = Math.random; const _chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$'; function getInt(a=0,b=0x100000000){ return _floor(_random() * (b - a)) + a; } function getStr(n=8){ let str=''; let i; for(i=0;i<n;i++) str+=_chars[getInt(0,64)]; return str } const _keys = []; const _values = []; (()=>{ let i; for(i=0;i<SIZE;i++) { _keys[i] = getStr(16); _values[i] = getInt(); } })();
Tests:
{}
const obj = {}; for(i=0;i<SIZE;i++) obj[_keys[i]] = _values[i];
new Object()
const obj = new Object() for(i=0;i<SIZE;i++) obj[_keys[i]] = _values[i];
Object.create(null)
const obj = Object.create(null); for(i=0;i<SIZE;i++) obj[_keys[i]] = _values[i];