dot notation vs bracket notation (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script>
  var structure = {
    a: '1',
    b: '2',
    c: '3',
    d: '4',
    e: '6',
    f: '7',
    g: '8'
  };
  function get(key) {
    return structure[key];
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
dot notation
structure.a == 1;
structure.b == 2;
structure.c == 3;
structure.d == 4;
structure.e == 5;
structure.f == 6;
structure.g == 7;
ready
bracket notation
structure['a'] == 1;
structure['b'] == 2;
structure['c'] == 3;
structure['d'] == 4;
structure['e'] == 5;
structure['f'] == 6;
structure['g'] == 7;
ready
bracket notation double quote
structure["a"] == 1;
structure["b"] == 2;
structure["c"] == 3;
structure["d"] == 4;
structure["e"] == 5;
structure["f"] == 6;
structure["g"] == 7;
ready
getter
get("a") == 1;
get("b") == 2;
get("c") == 3;
get("d") == 4;
get("e") == 5;
get("f") == 6;
get("g") == 7;
ready

Revisions

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