Clean Objects vs Normal Objects

Benchmark created by Caleb on


Description

I recently saw this this webcast about using clean objects instead of normal ones for things like hashmaps. Time to test it up and see if creation and access is actually any faster with these objects.

I've also included building objects explicitly because the result is...interesting.

Setup

var normal = {};
    var clean = Object.create(null, {});
    
    normal.val = true;
    clean.val = true;

Test runner

Ready to run.

Testing in
TestOps/sec
Build Normal Object
var a = {};
ready
Build Clean Object
var b = Object.create(null, {});
ready
Explicitly Build Normal Object
var c = Object.create({});
ready
Access Normal Object
var normalVal = normal.val;
ready
Access Clean Object
var cleanVal = clean.val;
ready
Add to Normal Object
normal.newVal = false;
ready
Add to Clean Object
clean.newVal = false;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.