Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1
Mobile Safari 16
iOS 16.6
Mobile
2 years ago
Benchmark.js
native .reduce() with flatmap, concat
1.2M/s
native .reduce() with map, spread
984K/s
npm:fast-cartesian
545/s
View exact numbers
Test name Executions per second
native .reduce() with flatmap, concat 1,200,065 Ops/sec
native .reduce() with map, spread 984,168 Ops/sec
npm:fast-cartesian 545 Ops/sec
Script Preparation code:
Tests: