scope crossing

Benchmark created by naugtur on


Description

How it's quicker to cache a objects in your current scope

Preparation HTML

<script>
  var someobj={a:1,b:2,c:3}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
no cache
(function(){
 someobj.a=123;
 someobj.b=123;
 someobj.c=123;
})()
ready
cached
(function(){
var so=someobj;
 so.a=123;
 so.b=123;
 so.c=123;
})()
ready

Revisions

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