Ghi chú phát hành được viết bằng tiếng Anh.
The most common way people work with lists of data now runs at full speed
Our from-scratch engine has a fast lane that turns the code a page runs over and over into native machine code, the fastest form a processor can execute. Two of the most common shapes in all of real JavaScript had been stuck in the slower lane: pulling one item out of a list and then reading or changing its fields (the everyday `const item = list[i]; total += item.price` pattern that sits at the heart of almost every table, feed, chart and cart on the web), and pulling several fields out of an item at once (called destructuring, `const {name, price} = list[i]`). The engine used to run the whole loop the slow way the moment it saw one of these. Now it compiles them to native code: on tight loops over lists of objects this runs about two and a half to three and a half times faster, and destructuring came along for free because it is built out of the same pieces. The result is byte-for-byte identical, only quicker. It is one more common pattern crossed off on the way to making our own engine fast enough to render everything you browse.
Những gì đã thay đổi
3 thay đổi- JavaScript và JITReading and updating the fields of an item taken from a list now compiles to native machine code, instead of dropping the whole loop into the slower interpreter. This is the `const item = list[i]; use item.field` pattern, which is close to universal in real code - every table row, feed post, chart point and cart line is written this way - so a wide range of everyday pages get faster at once. On tight loops it runs about 2.5x faster.
- JavaScript và JITDestructuring an item from a list (`const {name, price} = list[i]`, the modern shorthand for pulling several fields out at once) now compiles to native code as well, and got there for free: the engine builds it out of exactly the same machinery, so making the field-access pattern fast made this fast too, about 3.5x on hot loops.
- Bộ nhớ và đọcAs with every speed change in the engine, the result is identical to before - the same values, the same order, the same behaviour when a field is missing - only faster. The fast path steps carefully aside and lets the reliable slower path handle anything unusual (an item that is not an object, a field with special behaviour), so it is a pure speed-up with no change in what a page does, checked by running large randomised programs through both paths and confirming they never disagree.