mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibJS: Skip iterator result object allocation in for..of and for..in
Introduce special instruction for `for..of` and `for..in` loop that skips `{ value, done }` result object allocation if iterator is builtin (array, map, set, string). This reduces GC pressure significantly and avoids extracting the `value` and `done` properties. This change makes this micro benchmark 48% faster on my computer: ```js const arr = new Array(10_000_000); let counter = 0; for (let _ of arr) { counter++; } ```
This commit is contained in:
parent
ab52d86a69
commit
81b6a1100e
Notes:
github-actions[bot]
2025-04-30 18:52:38 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 81b6a1100e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4533
4 changed files with 94 additions and 23 deletions
|
@ -51,6 +51,7 @@
|
|||
O(EnterObjectEnvironment) \
|
||||
O(EnterUnwindContext) \
|
||||
O(Exp) \
|
||||
O(ForOfNext) \
|
||||
O(GetById) \
|
||||
O(GetByIdWithThis) \
|
||||
O(GetByValue) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue