Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Mobile/15E148 Safari/604.1
Mobile Safari 18
iOS 18.4
Mobile
one year ago
Benchmark.js
cartesian from https://stackoverflow.com/a/43053803
256.1M/s
native .reduce() with flatmap, concat
5.1M/s
native .reduce() with map, spread
3.4M/s
View exact numbers
| Test name |
Executions per second |
|
✓
cartesian from https://stackoverflow.com/a/43053803
|
256,142,512 Ops/sec |
|
native .reduce() with flatmap, concat
|
5,050,263 Ops/sec |
|
native .reduce() with map, spread
|
3,371,457 Ops/sec |
|
npm:fast-cartesian
|
2,166 Ops/sec |
Tests:
-
npm:fast-cartesian
-
native .reduce() with flatmap, concat
-
native .reduce() with map, spread
-
cartesian from https://stackoverflow.com/a/43053803