typecache

JavaScript performance comparison

Revision 3 of this test case created

Info

Explores performance impact of inline cache hits vs. misses.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
CacheHit
function demoInlineCacheHit() {
 var things = new Array(2);
 things[0] = {
  x: 0,
  y: 1,
  z: 3
 };
 things[1] = {
  x: 0,
  y: 1
 };
 var total = 0;
 for (var i = 0; i < 1000; i++) {
  total += things[i % 2].y;
 }
 return total;
}

demoInlineCacheHit();
pending…
CacheMiss
function demoInlineCacheMiss() {
 var things = new Array(2);
 things[0] = {
  x: 0,
  y: 1
 };
 things[1] = {
  y: 1,
  x: 0
 };
 var total = 0;
 for (var i = 0; i < 1000; i++) {
  total += things[i % 2].y;
 }
 return total;
}

demoInlineCacheMiss();
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