object maps -- map vs object vs struct (v3)

Revision 3 of this benchmark created on


Setup

var a = 1;
    var b = 2.15923;
    var c = 0xFFFFFF | 0;
    var d = 'asdf';
    var e = 'i should be undefined';
    
    var obj = {};
    obj[a] = a;
    obj[b] = b;
    obj[c] = c;
    obj[d] = d;
    
    var map = new Map();
    map.set(a, a);
    map.set(b, b);
    map.set(c, c);
    map.set(d, d);

Test runner

Ready to run.

Testing in
TestOps/sec
object get
obj[a];
obj[b];
obj[c];
obj[d];
obj[e];
ready
object set
obj[a] = a;
obj[b] = b;
obj[c] = c;
obj[d] = d;
obj[e] = e;
ready
map get
map.get(a);
map.get(b);
map.get(c);
map.get(d);
map.get(e);
 
ready
map set
map.set(a, a);
map.set(b, b);
map.set(c, c);
map.set(d, d);
map.set(e, e);
ready

Revisions

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