ASI performance

JavaScript performance comparison

Test case created by James Taylor

Preparation code

<script>
str = "count += 1"


n = 10000
arr = []
for (i = 0; i < n; i += 1) {
  arr.push(str)
}

sc = arr.join(";")
nl = arr.join("\n")
scnl = arr.join(";\n")
nlsc = arr.join("\n;")

</script>
      
<script>
Benchmark.prototype.setup = function() {
  
  count = 0
  

};
</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
with semicolons
eval('sc')
pending…
newlines only
eval('nl')
pending…
semicolon and newlines
eval('scnl')
pending…
newline then semicolon
eval('nlsc')
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