-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Move doc comment desugaring out of TokenCursor
.
#114273
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
Move doc comment desugaring out of TokenCursor
.
#114273
Conversation
Best reviewed one commit at a time. Local measurements showed some very small wins and losses that balanced out. Let's check on CI: @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 207e91f1f1bb8b7f30b81df3e7ee25e5b2bd7194 with merge c1da2ac8b4d0792d44e141afd78ed4de1889044f... |
This comment has been minimized.
This comment has been minimized.
`TokenCursor` currently does doc comment desugaring on the fly, if the `desugar_doc_comment` field is set. This requires also modifying the token stream on the fly with `replace_prev_and_rewind`. This commit moves the doc comment desugaring out of `TokenCursor`, by introducing a new `TokenStream::desugar_doc_comment` method. This separation of desugaring and iterating makes the code nicer.
It's no longer used.
It's only true at one call site; do the desugaring there instead.
207e91f
to
2e6ce68
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 2e6ce68 with merge 1c99872827b1b98e6ddd5920b7c0dfb26790528f... |
So, the performance assumption here is that if we create a parser for macro RHS, then it will go through all the input token stream without returning early (at least on a good path without errors). This assumption seems true, unless I'm missing something, so we can merge this. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (1c99872827b1b98e6ddd5920b7c0dfb26790528f): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 652.068s -> 652.15s (0.01%) |
Perf is as expected: very small icount regressions on @bors r=petrochenkov |
☀️ Test successful - checks-actions |
Finished benchmarking commit (d12c6e9): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: missing data |
It's awkward that
TokenCursor
sometimes desugars doc comments on the fly, but usually doesn't.r? @petrochenkov