lookup v alwaysset

Benchmark created by lauren on


Setup

var points = [],
        coverage = {};
    for (var i=0; i<10000; i++) {
        points.push(Math.random() * 10000);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
lookup to set
points.forEach(function(point) {
    if (!coverage[point]) coverage[point] = true;
});
ready
always set
points.forEach(function(point) {
    coverage[point] = true;
});
ready

Revisions

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

  • Revision 1: published by lauren on