Script Preparation code:
x
 
function* rangeGenerator(end, start = 0) {
  yield start
  if (start === end) return
  yield* rangeGenerator(end, start + 1)
}
Tests:
  • Generator

     
    const result = Array.from(rangeGenerator(20))
  • For loop

     
    const result = []
    for (let i = 0; i < 21; ++i) {
      result.push(i)
    }
  • UIntArray

     
    Array.from(new Uint8Array(21).map((_, i) => i))
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Generator
    For loop
    UIntArray

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15
Safari 14 on Mac OS X 11.0
View result in a separate tab
Test name Executions per second
Generator 148275.1 Ops/sec
For loop 12176332.0 Ops/sec
UIntArray 1243712.5 Ops/sec