Using in vs property access (v3)

Revision 3 of this benchmark created on


Description

Compares the performance of the "in" operator and the access of properties using []. Both for existing and non-existing properties.

Preparation HTML

<script type="application/javascript">

var obj1 = {
  testProp1: {}
};

var obj2 = {
  testProp2: {}
};

var obj3 = {
  testProp3: {}
};

var obj4 = {
  testProp4: {}
};

</script>

Test runner

Ready to run.

Testing in
TestOps/sec
property access existing
obj1["testProp1"]
ready
property access not existing
obj2["fail2"]
ready
in existing
"testProp3" in obj3
ready
in not existing
"fail4" in obj4
ready

Revisions

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