Stackoverflow - 8103451

JavaScript performance comparison

Revision 2 of this test case created

Info

http://stackoverflow.com/q/8380204/918414

Preparation code

<div id="container"></div>
<script>
Benchmark.prototype.setup = function() {
    var container = document.getElementById("container");
    var myScript = document.createElement("script");
};

Benchmark.prototype.teardown = function() {
    container.textContent = "";
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
eval
myScript.textContent = '';
container.appendChild(myScript);
eval('var y = 1; var x = 1;');
pending…
script
myScript.textContent = 'var y = 1; var x = 1;';
container.appendChild(myScript);
eval('');
pending…
hybrid
myScript.textContent = 'var y = 1;';
container.appendChild(myScript);
eval('var x = 1');
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