Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0
Firefox 127
Mac OS X 10.15
Desktop
2 years ago
Benchmark.js
native .reduce() with map, spread
9.4M/s
native .reduce() with flatmap, concat
5.1M/s
npm:fast-cartesian
4K/s
View exact numbers
Test name Executions per second
native .reduce() with map, spread 9,411,447 Ops/sec
native .reduce() with flatmap, concat 5,111,044 Ops/sec
npm:fast-cartesian 3,513 Ops/sec
Script Preparation code:
Tests: