typed arrays
JavaScript performance comparison
Info
Test the performance of typed arrays vs normal arrays
Preparation code
<script>
var N = 100000;
var arr = new Array(N),
i8arr = new Int8Array(N),
ui8arr = new Uint8Array(N),
i16arr = new Int16Array(N),
ui16arr = new Uint16Array(N),
i32arr = new Int32Array(N),
ui32arr = new Uint32Array(N),
f32arr = new Float32Array(N),
f64arr = new Float64Array(N);
var i;
for (i = 0; i < N; i++) {
arr[i] = i;
i8arr[i] = i;
ui8arr[i] = i;
i16arr[i] = i;
ui16arr[i] = i;
i32arr[i] = i;
ui32arr[i] = i;
f32arr[i] = i;
f64arr[i] = i;
}
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Array |
|
pending… |
i8arr |
|
pending… |
ui8arr |
|
pending… |
i16arr |
|
pending… |
ui16arr |
|
pending… |
i32arr |
|
pending… |
ui32arr |
|
pending… |
f32arr |
|
pending… |
f64arr |
|
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 2: published by Dmitry Podgorniy
- Revision 3: published
0 comments