Property Lookup Performance

Benchmark created by Property Lookup (1000 v. 1000000) on


Description

Based on http://stackoverflow.com/questions/3858411/whats-the-big-o-for-javascripts-array-when-used-as-a-hash

Preparation HTML

<script>

function gen(size) {
    var o = {};
    o.size = size;
    for (var i = 0; i < size; i ++) o['item' + i] = 'hello';
    return o;
}

function lookup(o) {
    return o['item' + ~~(Math.random() * o.size)];
}

var small = gen(1000), large = gen(1000000);

</script>

Test runner

Ready to run.

Testing in
TestOps/sec
small
lookup(small);
ready
large
lookup(large);
ready

Revisions

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

  • Revision 1: published by Property Lookup (1000 v. 1000000) on