array with range of items

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
while approach
const range = (start, end) => {
	  let counter = start
	  const output= []
	
	  while (counter <= end) {
	    output.push(counter)
	    counter++
	  }
	
	  return output
	}
	
	range(258, 357)
ready
array from approach
const range = (start, end) => 
	  Array.from({ length: end - start + 1 }, (_, i) => start + i)
	  	range(258, 357)
ready

Revisions

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