range creation

Benchmark created on


Setup

function getRangeArrayFrom(startFrom, until) {
  return Array.from({ length: until + 1 - startFrom }, (_, k) => k + startFrom);
}

function rangeKeysSpread(startFrom, until) {
    return [...Array(until - startFrom + 1).keys()].map(i => i + startFrom);
}

Test runner

Ready to run.

Testing in
TestOps/sec
getRangeArrayFrom
getRangeArrayFrom(0, 1000)
ready
rangeKeysSpread
rangeKeysSpread(0, 1000)
ready

Revisions

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