-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Store tokens inside ast::Expr
#72287
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Finished benchmarking try commit 2728275cf62b7f7bfb2bbc99674bd8476722477a, comparison URL. |
Not sure why there's such slowdown, absolute majority of expressions doesn't have attributes. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Finished benchmarking try commit 11e2f20befcdd9b10073fe96ba2e880ac822352d, comparison URL. |
72b44ee
to
4855363
Compare
Let's make sure that my new @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking try commit 7bc7cfa40f58523836318ebc43f17436ce067963, comparison URL. |
FWIW, the code looks mergeable and I'm really excited about the UX improvement. |
4855363
to
d5a2dbe
Compare
I'll review this in detail ~tomorrow, but from a cursory view the collecting mechanism change in |
@petrochenkov: I opened #72393 with just the |
Blocked on #72393. |
…okens, r=petrochenkov Rewrite `Parser::collect_tokens` The previous implementation did not work when called on an opening delimiter, or when called re-entrantly from the same `TokenCursor` stack depth. I'm not sure how to test this apart from rust-lang#72287
…okens, r=petrochenkov Rewrite `Parser::collect_tokens` The previous implementation did not work when called on an opening delimiter, or when called re-entrantly from the same `TokenCursor` stack depth. I'm not sure how to test this apart from rust-lang#72287
This comment has been minimized.
This comment has been minimized.
d5a2dbe
to
14382c6
Compare
@petrochenkov: Rebased |
@bors r+ |
📌 Commit 14382c6 has been approved by |
☀️ Test successful - checks-azure |
This is a smaller version of #70091.
We now store captured tokens inside
ast::Expr
, which allows us to avoid some reparsing innt_to_tokenstream
. To try to mitigate the performance impact, we only collect tokens when we've seen an outer attribute.This makes progress towards solving #43081. There are still many things left to do:
#[cfg]
attr is used.However, this is enough to fix spans for a simple example, which I've included as a test case.