Key Lookup (v127)

Revision 127 of this benchmark created on


Description

Direct array element lookup vs object key lookup

Setup

var a1 = [], o = {}, a2=null;
    for( i=0; i <=200; i ++){
      a1.push( { id: 'abcdefghijklmnopqrstuvwxyz' + i, name: 'name' });
      o[i] = { id: 'abcdefghijklmnopqrstuvwxyz' + i, name: 'name' };
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Manual Array Lookup
var id = 199 ;
result = a1[id];
 
ready
Object by Key
var key = 'abcdefghijklmnopqrstuvwxyz199';
var result = o[key];
 
ready

Revisions

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