Stackoverflow - eval vs script

JavaScript performance comparison

Test case created by ThinkingStiff

Info

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

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    <div id="hello"></div>
};
</script>

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
//eval( "var x" );
pending…
script
//var myScript = document.createElement( 'script' );
//myScript.setAttribute( 'type', 'text/javascript' );
//myScript.innerHTML = "var x";
//document.body.appendChild( myScript );
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment