Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey these changes are a part of a heap profiling pass that we've been working on. It basically identifies the most common things that are slowing down the parser or things that are being allocated but never used.
Quick run-down:
876e8b9: These vecs are allocated with a certain size, but it is often the case that they are never used. We let the allocator give them size in the case that they are used.
67faebf: Often seek is 0 so we don't need to do the memory copying and overwriting unless it's different.
f9b0f9d: The reference inlines noramlly don't have a delimiter, so we start the delimiter with zero capacity.
2e00ec7: Big win, often scanners.rs creates a large reference structure when we could just check the very first character. Since these are called so often this eliminates a large amount of unneeded allocations.
Benches are done on average of 3.
Bench speedup:
(9,511,724 + 9,335,745 + 9,226,028)/3 = 9357832
Bench master:
(12,177,662 + 12,865,365 + 12,590,586)/3 = 12544537