Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
{} vs new Object() vs Object.null (Read)
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
Browser:
Chrome 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
{}
44163.9 Ops/sec
new Object()
44380.8 Ops/sec
Object.create(null)
41273.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(); } })(); const obj_1 = {}; const obj_2 = new Object(); const obj_3 = Object.create(null); for(i=0;i<SIZE;i++) { obj_1[_keys[i]] = _values[i]; obj_2[_keys[i]] = _values[i]; obj_3[_keys[i]] = _values[i]; }
Tests:
{}
for(i=0;i<SIZE;i++) var value = obj_1[_keys[i]]
new Object()
for(i=0;i<SIZE;i++) var value = obj_2[_keys[i]]
Object.create(null)
for(i=0;i<SIZE;i++) var value = obj_3[_keys[i]]