Typed array iteration
JavaScript performance comparison
Info
Added Canvas
Preparation code
<canvas width="10" height="50" id="canvas"></canvas>
<script>
var classic = new Array(2000);
var canvas = document.getElementById("canvas").getContext("2d").getImageData(0, 0, 10, 50).data; // 50 * 10 * 4 = 2000
var unfixed = new Uint8Array();
var fixed = new Uint8Array(2000);
for (var i = 0; i < 2000; ++i) {
var number = ~~ (Math.random() * 200)
classic[i] = number;
canvas[i] = number;
unfixed[i] = number;
fixed[i] = number;
}
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Classic |
|
pending… |
Canvas |
|
pending… |
Unfixed |
|
pending… |
Fixed |
|
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 Bruno Garcia
- Revision 2: published by vjeux
- Revision 3: published by vjeux
- Revision 6: published by vjeux
- Revision 9: published by vjeux
- Revision 10: published by vjeux
- Revision 13: published by vjeux
- Revision 22: published
- Revision 23: published
- Revision 25: published
- Revision 26: published
- Revision 27: published
- Revision 28: published
- Revision 29: published
- Revision 31: published by Bart
0 comments