Profile: https://share.firefox.dev/4ajW3kw I see two things: 1. The CPU work of decoding and storing the bytes is where most of the time (78%) is spent. 2. We decode into a temporary buffer and do a copy rather than adopting the buffer into the typed array. The copy seems worth avoiding. `TypedArray::fromLength` also has the cost of zeroing the allocated buffer, which is unnecessary since we're going to overwrite all of it.
Bug 2003305 Comment 1 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Profile: https://share.firefox.dev/4ajW3kw I see two things: 1. The CPU work of decoding and storing the bytes is where most of the time (78%) is spent. 2. We decode into a temporary buffer and do a copy rather than adopting the buffer into the typed array. The copy seems worth avoiding. `TypedArray::fromLength` also has the cost of zeroing the allocated buffer, which is unnecessary since we're going to overwrite all of it. *Edit: Ah, André had already filed bug 1996197 about the copy, nice.*
Profile: https://share.firefox.dev/4ajW3kw I see two things: 1. The CPU work of decoding and storing the bytes is where most of the time (78%) is spent. 2. We decode into a temporary buffer and do a copy rather than adopting the buffer into the typed array. The copy seems worth avoiding. `TypedArray::fromLength` also has the cost of zeroing the allocated buffer, which is unnecessary since we're going to overwrite all of it. *Edit: Ah, André had already filed [bug 1996197](https://bugzilla.mozilla.org/show_bug.cgi?id=1996197) about the copy, nice.*