-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Special-case literals in parse_bottom_expr
.
#61612
Conversation
@bors try |
Special-case literals in `parse_bottom_expr`. This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it skips the allocation done by the `mk_expr` call in `parse_literal_maybe_minus`. r? @petrochenkov
☔ The latest upstream changes (presumably #61541) made this pull request unmergeable. Please resolve the merge conflicts. |
☀️ Try build successful - checks-travis |
a4952ba
to
c1947b1
Compare
Rebased. @bors try |
⌛ Trying commit c1947b171c7cedb269b5022f16cd3c92592aceb5 with merge ad061396c7509b3356c9bb5cfa0a8b3f54d9924e... |
@bors rollup=never, because this affects performance. |
☀️ Try build successful - checks-travis |
@rust-timer build ad061396c7509b3356c9bb5cfa0a8b3f54d9924e |
Success: Queued ad061396c7509b3356c9bb5cfa0a8b3f54d9924e with parent d132f54, comparison URL. |
Finished benchmarking try commit ad061396c7509b3356c9bb5cfa0a8b3f54d9924e, comparison URL. |
Nice, I didn't expect an effect like this from parser changes. Could you move the common code from the added snippet and from its original code below into a closure/function/macro? |
You mean the |
@nnethercote |
This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it replaces the unnecessary `parse_literal_maybe_minus` call with `parse_lit`, avoiding an unnecessary allocation via `mk_expr`.
c1947b1
to
35b5f43
Compare
@bors r+ rollup |
📌 Commit 35b5f43 has been approved by |
@bors rollup=never, because this affects performance. |
Trying again... @bors rollup=never |
Ok, that worked. Looks like the reason for the rollup-never must not be on the same line. |
…pr, r=petrochenkov Special-case literals in `parse_bottom_expr`. This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it skips the allocation done by the `mk_expr` call in `parse_literal_maybe_minus`. r? @petrochenkov
…chenkov Special-case literals in `parse_bottom_expr`. This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it skips the allocation done by the `mk_expr` call in `parse_literal_maybe_minus`. r? @petrochenkov
☀️ Test successful - checks-travis, status-appveyor |
Tested on commit rust-lang/rust@55cee44. Direct link to PR: <rust-lang/rust#61612> 🎉 rls on linux: test-fail → test-pass (cc @Xanewok, @rust-lang/infra).
This makes parsing faster, particularly for code with large constants,
for two reasons:
mk_expr
call inparse_literal_maybe_minus
.r? @petrochenkov