nested property lookup, cached or not (v8)

Revision 8 of this benchmark created by sansegot on


Description

Testing/profiling the code patterns from the Script Junkie article "(pre)Maturely Optimize Your JavaScript"

http://msdn.microsoft.com/en-us/scriptjunkie/gg622887.aspx

Snippet comparison #6

Preparation HTML

<script>
  var foo = {
   bar: [
    {
     fun: [1,2,3]
    }
   ]
  },
      _fun = foo.bar[0].fun[1],
      res;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
full property lookup
res = foo.bar[0].fun[1]; // not using the cached property lookup
ready
cached property lookup
res = _fun; // using the cached property lookup
ready

Revisions

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

  • Revision 1: published by Kyle Simpson on
  • Revision 2: published by redsquare on
  • Revision 3: published by redsquare on
  • Revision 4: published by redsquare on
  • Revision 6: published by js user on
  • Revision 7: published on
  • Revision 8: published by sansegot on