eval kills

JavaScript performance comparison

Test case created by John-David Dalton and last updated

Preparation code

setTimeout(function() {
  ui.benchmarks[0].options.setup = 'eval("var str=\'hello world\'")';
}, 0);
Benchmark.prototype.setup = function() {
    var str = 'hello world';

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
with eval
r = str.charAt() + str.slice(1);
without eval
r = str.charAt() + str.slice(1);

Compare results of other browsers


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:

1 comment

John-David Dalton (revision owner) commented :

The point of this test is to show that simply using eval still disables engine optimizations for the method but may not be a perf problem in average use.

Comment form temporarily disabled.

Add a comment