-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Lexer: check in advance_token
to avoid regard spare ##
as GardedStrPrefix
#141028
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
base: master
Are you sure you want to change the base?
Conversation
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
1ab58fc
to
3fe5df4
Compare
###
to avoid regard ##
as GardedStrPrefixadvance_token
to avoid regard spare ##
as GardedStrPrefix
@rustbot ready |
r? compiler |
r? compiler |
heya, you now unconditionally look at the previous character every step of tokenization. I'm admittedly somewhat new to review rotation, and don't have a good intuition to how much lexing matters in perf. My expectation is 0 but I'm interested in the outcome of a perf run because of that. Will be reviewing more, but initial pass looks reasonable @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (606582d): comparison URL. Overall result: no relevant changes - no 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 5.4%)This 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (secondary 0.0%)This 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: 752.053s -> 750.495s (-0.21%) |
Signed-off-by: xizheyin <[email protected]>
…fix` Signed-off-by: xizheyin <[email protected]>
This was based on a very old base, so I rebased it to the new master branch. I don't think this will have much of an impact on performance, however I'm not quite sure why |
This comment was marked as off-topic.
This comment was marked as off-topic.
1 similar comment
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm curious as to how these permissions were obtained. Because a couple of previous reviewers said |
both reviews and perf runs can only be done by team members. Sometimes a reviewer says r=me which effectively means any team member can merge it, the review has been done. For you it means, that's the last problem with your PR, after that someone (maybe them) will merge. Sometimes a reviewer can delegate these powers to non team members, but you can't do this yourself. |
@@ -371,6 +371,7 @@ pub fn is_ident(string: &str) -> bool { | |||
impl Cursor<'_> { | |||
/// Parses a token from the input string. | |||
pub fn advance_token(&mut self) -> Token { | |||
let pre_char = self.prev(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.prev() is only for debug builds (read its documentation)
In general, it feels to me like these checks should be part of |
it will parse the last I think this recognition should be corrected in |
No it's there for a reason, if you look prev is only used in debug assertions. We don't really want to look behind, so you likely want to find another way to do this |
Okay, I'll re-investigate when I get some free time. |
Fixes #140618
I performed additional checks to avoid treating the two
##
afterr#‘xxx’####
asGardedStrPrefix
.GardedStrPrefix
is introduced in 321a5db.r? compiler