Sparse Array vs. Push

Benchmark created by Baz on


Setup

var ran,
        a = [];

Test runner

Ready to run.

Testing in
TestOps/sec
aa
ran = Math.floor((Math.random() * 9999999) + 1);
a[ran] = true;
ready
bb
ran = Math.floor((Math.random() * 9999999) + 1);
a.push(true);
ready

Revisions

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