istrn

JavaScript performance comparison

Test case created by PetkaAntonov

Preparation code

<script>
String.prototype.intern = function() {

    "use strict";
    return new Function('return "'+this+'"')();
};

</script>
      
<script>
Benchmark.prototype.setup = function() {
  var num1 = Math.random();
  var num2 = Math.random();
  
  var str1 = "hello" + num1;
  var str2 = "hello" + num1;
  
  var iStr1 = ("hello" + num2).intern();
  var iStr2 = ("hello" + num2).intern();

};
</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
1
if (str1 !== str2) die()
pending…
2
if (iStr1 !== iStr2) die()
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