Fake Loops

JavaScript performance comparison

Revision 19 of this test case created by Lockal

Info

Loops for tiny arrays, w/ and w/o cashing

Preparation code

<script>
  var arr = [
   [1],
   [1],
   [1],
   [1],
   [1],
   [1],
   [1],
   [1]
  ];
  var something;
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Wich cashing
for (var i = 0; i < 8; ++i) {
 for (var j = 0, s = arr.length; j < s; ++j) {
  something += j % 2 * arr[i][j];
 }
}
pending…
Without caching
for (var i = 0; i < 8; ++i) {
 for (var j = 0; j < arr.length; ++j) {
  something += j % 2 * arr[i][j];
 }
}
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:

0 comments

Add a comment