Script Preparation code:
AخA
 
var size = 0xffffff;
var data = Array.from({length: size}, (_, index) => index);
Tests:
  • Array[] array.length - 1

     
    let sum = 0;
    for (let i; i < size; i++) {
      sum += data[array.length - 1];
    }
  • Array.at() -1

     
    let sum = 0;
    for (let i; i < size; i++) {
      sum += data.at(-1);
    }
  • Array[] cached array.length - 1

     
    let sum = 0;
    let length = data.length;
    for (let i; i < size; i++) {
      sum += data[length -1];
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array[] array.length - 1
    Array.at() -1
    Array[] cached array.length - 1

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 29 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0
Chrome 133 on Windows
View result in a separate tab
Test name Executions per second
Array[] array.length - 1 34375700.0 Ops/sec
Array.at() -1 35951580.0 Ops/sec
Array[] cached array.length - 1 33454528.0 Ops/sec