Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax/utf8: avoid a spurious vector reallocation
This reworks `Utf8Sequences` logic in order to avoid allocating a 0-sized vector and immediately reallocating it for the initial element. Directly create the populated vector instead. I was looking at the memory usage patterns of [rolldown] through heaptrack, and this spot showed up as a potentially-spurious temporary allocation. The consumer side is [here][consumer side]. I do not have a specific benchmark for this. [rolldown]: https://github.com/rolldown/rolldown [consumer side]: https://github.com/rolldown/rolldown/blob/ce36a195ed4e9ce7c446557cefff4750a2268e01/crates/rolldown/src/utils/extract_hash_pattern.rs#L12
- Loading branch information