eva vs object[attr]

JavaScript performance comparison

Test case created by Nando Vieira

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
var person = {
    name: "John Doe"
  , email: "john@example.org"
  , age: 33
  , phone: "+551112345678"
  , address: "R. Vergueiro, 1421, São Paulo/SP"
};

var attrs = ["name", "email", "age", "phone", "address"];

attrs.forEach(function(attr){
  var value = eval("person." + attr);
});
pending…
object[attr]
var person = {
    name: "John Doe"
  , email: "john@example.org"
  , age: 33
  , phone: "+551112345678"
  , address: "R. Vergueiro, 1421, São Paulo/SP"
};

var attrs = ["name", "email", "age", "phone", "address"];

attrs.forEach(function(attr){
  var value = person[attr];
});
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