Script Preparation code:
AخA
 
var testVar = 10;
Tests:
  • Do not cache at all

     
    function doTest1(){
      var sum = 0;
      for (var i = 0; i < testVar; i++){
        sum = sum + i;
      }
    }
    doTest1();
  • Cache in the inner scope

     
    function doTest2(){
      var sum = 0;
      var testVarLocal = testVar;
      for (var i = 0; i < testVarLocal; i++){
        sum = sum + i;
      }
    }
    doTest2();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Do not cache at all
    Cache in the inner scope

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27
Chrome 105 on Windows
View result in a separate tab
Test name Executions per second
Do not cache at all 1245493.4 Ops/sec
Cache in the inner scope 10284105.0 Ops/sec