V8: Replace forLoop for forLoop reverse in getHeapSpaceStatistics
Replace forLoop for forLoop reverse, pre-decrement to improve the performance.
After running V8 benchmark this is the result:
for loop
:
With the actual v8/get-stats.js
v8/get-stats.js n=1000000 method="getHeapStatistics": 3,925,281.1737783994
v8/get-stats.js n=1000000 method="getHeapSpaceStatistics": 3,079,267.8209353415
for loop, reverse, pre-decrement
:
With v8/get-stats.js
v8/get-stats.js n=1000000 method="getHeapStatistics": 3,414,352.1774798837
v8/get-stats.js n=1000000 method="getHeapSpaceStatistics": 2,875,818.4633268225
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
V8