.(dot) vs [](square bracket) (v8)

Revision 8 of this benchmark created by mah0x211 on


Preparation HTML

<script>
var foo = {
    path: {
        to: {
            node: {
                value: 'value'
            }
        }
    }
};
var bar = {
    'path.to.node.value': 'value'
};
var baz = {
    'this.is.long.path.name.foo.bar.baz.path.to.node.value': 'value'
};
var qux = {
    'value': 'value'
};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.
var a = window.document;
ready
[]
var a = window["document"];
ready
foo
var a = foo.path.to.node.value;
ready
bar
var a = bar['path.to.node.value'];
ready
baz
var a = baz['this.is.long.path.name.foo.bar.baz.path.to.node.value'];
ready
qux
var a = qux['value'];
ready

Revisions

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

  • Revision 1: published by JavaScript Nazi on
  • Revision 2: published by Kyle Simpson on
  • Revision 5: published by Michael Norman on
  • Revision 6: published by blocks-vs-functions on
  • Revision 7: published on
  • Revision 8: published by mah0x211 on
  • Revision 9: published by mah0x211 on
  • Revision 13: published on
  • Revision 15: published on
  • Revision 18: published by foo on