Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 YaBrowser/24.4.0.0 Safari/537.36
Yandex Browser 24
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
native .reduce() with map, spread
3.2M/s
native .reduce() with flatmap, concat
1.9M/s
npm:fast-cartesian
8K/s
View exact numbers
Test name Executions per second
native .reduce() with map, spread 3,200,642 Ops/sec
native .reduce() with flatmap, concat 1,872,808 Ops/sec
npm:fast-cartesian 8,180 Ops/sec
Script Preparation code:
Tests: