The for
loop outperforms the binary search.
(well, the forEach
did, until we changed the caching in an unrelated function)
And the optimizations have (almost) nothing to do with the algorithms.
(changing any code can massively change the performance of any benchmark)
See the video: https://www.youtube.com/watch?v=0mmi44ZB2C0