After getting the tip to use JSLitmus for JavaScript microbenchmarks I grabbed my old "How to access JavaScript Object" code and build some tests with JSLitmus. The following question was sometimes very religious and only benchmarks can solve the problem:
The question is simple: what is faster?
obj = {a:1};
//variant 1
result = obj.a;
//variant 2
result = obj['a'];
//variant 3 - build an object with getter function:
result = obj.getA();
Read more