-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TokenStream
improvements
#56737
TokenStream
improvements
#56737
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The first commit just replicates #56699, which is a prerequisite. Once that lands I will rebase to remove that commit from this PR. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Oh, I need to use |
This shrinks: - ThinTokenStream: 16 to 8 bytes - TokenTree: 32 to 24 bytes - TokenStream: 40 to 32 bytes The only downside is that in a couple of places this requires using `to_vec()` (which allocates) instead of `sub_slice()`. But those places are rarely executed, so it doesn't hurt perf. Overall, this reduces instruction counts on numerous benchmarks by up to 3%.
It's a better choice in a few places.
They're both unused now.
Because the distinction provides little value, and removing it cleans up the code quite a bit.
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
fa14050
to
e80c7dd
Compare
I switched to |
✌️ @nnethercote can now approve this pull request |
📌 Commit e80c7dd has been approved by |
…henkov `TokenStream` improvements Some `TokenStream` improvements: shrinking `TokenStream` and some other types, and some other code clean-ups.
☀️ Test successful - status-appveyor, status-travis |
Some
TokenStream
improvements: shrinkingTokenStream
and some other types, and some other code clean-ups.