Skip to content
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

Merged
merged 1 commit into from Jun 12, 2019

Conversation

@nnethercote
Copy link
Contributor

commented Jun 7, 2019

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

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 7, 2019

@bors try

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

⌛️ Trying commit a4952ba with merge ec9590e...

bors added a commit that referenced this pull request Jun 7, 2019

Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=<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
@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

☔️ The latest upstream changes (presumably #61541) made this pull request unmergeable. Please resolve the merge conflicts.

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

☀️ Try build successful - checks-travis
Build commit: ec9590e

@nnethercote nnethercote force-pushed the nnethercote:improve-parse_bottom_expr branch from a4952ba to c1947b1 Jun 8, 2019

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 8, 2019

Rebased.

@bors try

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 2019

⌛️ Trying commit c1947b1 with merge ad06139...

bors added a commit that referenced this pull request Jun 8, 2019

Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=<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
@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 8, 2019

@bors rollup=never, because this affects performance.

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 2019

☀️ Try build successful - checks-travis
Build commit: ad06139

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 8, 2019

@rust-timer

This comment has been minimized.

Copy link

commented Jun 8, 2019

Success: Queued ad06139 with parent d132f54, comparison URL.

@rust-timer

This comment has been minimized.

Copy link

commented Jun 8, 2019

Finished benchmarking try commit ad06139, comparison URL.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 2019

Nice, I didn't expect an effect like this from parser changes.
All the >1% improved tests are small or synthetic though.

Could you move the common code from the added snippet and from its original code below into a closure/function/macro?
parse_literal_maybe_minus below is unnecessary/wrong since we are parsing a bottom expression, so parse_lit needs to be used in both cases.

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 8, 2019

You mean the parse_literal_maybe_minus in the _ match arm at the bottom of parse_bottom_expr can be parse_lit?

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 2019

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 replaces the unnecessary `parse_literal_maybe_minus` call with
  `parse_lit`, avoiding an unnecessary allocation via `mk_expr`.

@nnethercote nnethercote force-pushed the nnethercote:improve-parse_bottom_expr branch from c1947b1 to 35b5f43 Jun 10, 2019

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

@bors r+ rollup

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

📌 Commit 35b5f43 has been approved by petrochenkov

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

@bors rollup=never, because this affects performance.

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

Trying again...

@bors rollup=never

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

Ok, that worked. Looks like the reason for the rollup-never must not be on the same line.

Centril added a commit to Centril/rust that referenced this pull request Jun 10, 2019

Rollup merge of rust-lang#61612 - nnethercote:improve-parse_bottom_ex…
…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

bors added a commit that referenced this pull request Jun 12, 2019

Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=petro…
…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
@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

⌛️ Testing commit 35b5f43 with merge 55cee44...

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: petrochenkov
Pushing 55cee44 to master...

@bors bors added the merged-by-bors label Jun 12, 2019

@bors bors merged commit 35b5f43 into rust-lang:master Jun 12, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 12, 2019

📣 Toolstate changed by #61612!

Tested on commit 55cee44.
Direct link to PR: #61612

🎉 rls on linux: test-fail → test-pass (cc @Xanewok, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jun 12, 2019

📣 Toolstate changed by rust-lang/rust#61612!
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).

@nnethercote nnethercote deleted the nnethercote:improve-parse_bottom_expr branch Jun 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.