Constant vs string object property key

Benchmark created by Eero Heikkinen on


Preparation HTML

<script>
  var obj = {longPropertyName: "Lorum Ipsum"}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
constant
var foo = obj.longPropertyName;
ready
string
var name = "longPropertyName";
var foo = obj[name];
ready

Revisions

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

  • Revision 1: published by Eero Heikkinen on