Eval vs new Function vs function() (v7)

Revision 7 of this benchmark created by RedKungFuMastr on


Preparation HTML

<script>
var values = [ 5,10 ];
</script>

Setup

var fromString = new Function( 'return values[0] + values[1]' );
    
    var _function = function(){ return values[0] + values[1] };

Test runner

Ready to run.

Testing in
TestOps/sec
Eval
eval('values[0] + values[1]');
ready
new Function
fromString();
ready
function
_function();
ready

Revisions

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