Array vs Object read/write
JavaScript performance comparison
Info
Test Object/Array access
Preparation code
<script>
Benchmark.prototype.setup = function() {
var array = [
0,0,0,0,
0,0,0,0,
0,0,0,0,
0,0,0,0
];
var obj = {
m0:0,m1:0,m2:0,m3:0,
m4:0,m5:0,m6:0,m7:0,
m8:0,m9:0,m10:0,m11:0,
m12:0,m13:0,m14:0,m15:0
};
var nativeArray = new Array(array);
var int8Array = new Int8Array(array);
var int16Array = new Int16Array(array);
var int32Array = new Int32Array(array);
var float32Array = new Float32Array(array);
var float64Array = new Float64Array(array);
var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Object read |
|
pending… |
Object write |
|
pending… |
Array read |
|
pending… |
Array write |
|
pending… |
Int8Array read |
|
pending… |
Int8Array write |
|
pending… |
literal Array read |
|
pending… |
literal Array write |
|
pending… |
Int16Array read |
|
pending… |
Int16Array write |
|
pending… |
Int32Array read |
|
pending… |
Int32Array write |
|
pending… |
Float32Array read |
|
pending… |
Float32Array write |
|
pending… |
Float64Array read |
|
pending… |
Float64Array write |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by 1Pupik1989
- Revision 2: published by 1Pupik1989
- Revision 3: published by 1Pupik1989
0 comments