String interning after operations

JavaScript performance comparison

Revision 4 of this test case created by Sandro Hawke

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var obj1 = new Object();
  var obj2 = new Object();
  var obj3 = obj1;
  var str1 = "a string";
  var str2 = "a string";
  var str3 = str1.slice(0,1)+str2.slice(1);
  var str4 = JSON.parse(JSON.stringify(str3));
  var str5 = JSON.parse(JSON.stringify(str1));

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
diff obj
obj1 === obj2
pending…
same obj
obj1 === obj3
pending…
same obj ==
obj1 == obj3
pending…
same str ==
str1 == str2
pending…
same str ===
str1 === str2
pending…
same str op ==
str1 == str3
pending…
same str op ===
str1 === str3
pending…
forcing intern ==
str1 == str4
pending…
forcing intern ===
str1 === str4
pending…
two jsons?
str4 === str5
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.

0 Comments