lib: avoid using Array.prototype.forEach
Using Array.prototype.forEach()
is still significantly slower than traditional array iteration. This PR adds a benchmark and replaces many (but not all) forEach()
uses within lib.
count method rate confidence.interval
5 array 166.1422406 8.76899908
5 forEach 7.5412201 0.48229307
10 array 75.8375035 4.85803234
10 forEach 4.3405191 0.29654176
20 array 32.5185750 2.20360039
20 forEach 2.5431252 0.14517229
100 array 8.9249754 0.44583628
100 forEach 0.5816331 0.03092516
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
lib