javascript associative vs non-associative arrays with assignment (v14)

Revision 14 of this benchmark created on


Description

The initial tests, but looking at assignment time.

Preparation HTML

<script>
  var arr = [];
  var asc = {};
  var asd = {};
  var ase = [];
  var asf = [];
  
  arr[0] = 0;
  arr[1] = 1;
  arr[2] = 2;
  
  asc.i0 = 0;
  asc.i1 = 1;
  asc.i2 = 2;
  
  asd.a = 0;
  asd.b = 1;
  asd.c = 2;
  
  ase['i0'] = 0;
  ase['i1'] = 1;
  ase['i2'] = 2;
  
  asf['a'] = 0;
  asf['b'] = 1;
  asf['c'] = 2;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Object access with numbers
asc.i0=[];
asc.i1=[];
asc.i2=[];
ready
Object Access without numbers
asd.a=[];
asd.b=[];
asd.c=[];
ready
Associative Array with numbers
ase['i0']=[];
ase['i1']=[];
ase['i2']=[];
ready
Associative Array without numbers
asf['a']=[];
asf['b']=[];
asf['c']=[];
ready
Array access
arr[0]=[];
arr[1]=[];
arr[2]=[];
ready

Revisions

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