版本说明以英文撰写。
Loops that call a helper get compiled
This is the start of the single biggest step for JavaScript speed. Until now, the moment a hot loop called a function, Floati handed the whole loop back to the slower interpreter, because calling a function is a lot of hidden work: setting up a fresh scope, matching arguments to parameters, and jumping in and out. That is a real limit, because so much real code is loops that call a small helper (a bit of math, a hash mix, a transform). Floati now recognises when that helper is small and self-contained, a function that just returns a calculation on its inputs, and pastes its work directly into the loop, so there is no call to make at all. In our benchmark a loop calling such a helper a million times runs about three times faster. This first step is deliberately careful: it only does this for helpers that are pure arithmetic on their arguments (no side effects, no reaching outside themselves), and the instant a helper is anything more, or gets swapped out mid-loop, Floati falls straight back to the normal path with no change in results. More kinds of helper will follow. The full engine test suite passes identically with the speed-up switched on and off.
改动内容
3 项改动- JavaScript 与 JITLoops that call a small helper function now compile. Until now, the moment a hot loop called a function Floati handed the whole loop back to the slower interpreter, and so much real code is a loop calling a little helper: a bit of math, a hash mix, a transform.
- JavaScript 与 JITFloati now recognises a small, self-contained helper that just returns a calculation on its inputs and pastes its work directly into the loop, so there is no call to make. A loop calling such a helper a million times runs about three times faster.
- JavaScript 与 JITDeliberately careful: only pure-arithmetic helpers with no side effects, and the instant a helper is anything more or gets swapped out mid-loop, Floati falls back with no change in results.





