Cost of scope lookups

Benchmark created by Andrew Hedges on


Preparation HTML

<script>
  var myvar = 'a string';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Lookup
(function() {
  var a = myvar;
}())
ready
By Reference
(function(myvar) {
  var a = myvar;
}(myvar))
ready

Revisions

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