Skip to content

Commit 38b689a

Browse files
Mention Array.prototype.fill special case (#794)
https://chromium-review.googlesource.com/c/v8/v8/+/6285929
1 parent 22f6aeb commit 38b689a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/blog/elements-kinds.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ V8 implements this tag transitioning system as a [lattice](https://en.wikipedia.
104104

105105
It’s only possible to transition downwards through the lattice. Once a single floating-point number is added to an array of Smis, it is marked as DOUBLE, even if you later overwrite the float with a Smi. Similarly, once a hole is created in an array, it’s marked as holey forever, even when you fill it later.
106106

107+
:::note
108+
**Update @ 2025-02-28:** There is now an exception to this [for `Array.prototype.fill` specifically](https://chromium-review.googlesource.com/c/v8/v8/+/6285929).
109+
:::
110+
107111
V8 currently distinguishes [21 different elements kinds](https://cs.chromium.org/chromium/src/v8/src/elements-kind.h?l=14&rcl=ec37390b2ba2b4051f46f153a8cc179ed4656f5d), each of which comes with its own set of possible optimizations.
108112

109113
In general, more specific elements kinds enable more fine-grained optimizations. The further down the elements kind is in the lattice, the slower manipulations of that object might be. For optimal performance, avoid needlessly transitioning to less specific types — stick to the most specific one that’s applicable to your situation.

0 commit comments

Comments
 (0)