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

More unescaping cleanups #118897

Merged
merged 5 commits into from
Dec 16, 2023
Merged

Conversation

nnethercote
Copy link
Contributor

More minor improvements I found while working on #118699.

r? @fee1-dead

Raw strings don't have escape sequences, so for them "unescaping" just
means checking for invalid chars like bare CR. Which means there is no
need to rebuild them one char or byte at a time while escaping, because
the unescaped version will be the same. This commit removes that
rebuilding.

Also, the commit changes things so that "unescaping" is unconditional for
raw strings and raw byte strings. That's simpler and they're rare enough
that the perf effect is negligible.
The `span` arg is described in a comment as "interior span of the
literal, without quotes", which is incorrect. It's actually the span of
the error part of the literal, corresponding to `range`.

This commit renames `span` and `span_without_quotes` to make things
clearer, and fixes the erroneous comment.
Some cases are unreachable.
The two cases are equivalent. C string literals aren't common so there
is no performance need here.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 12, 2023
`unescape_raw_str_or_raw_byte_str` only does checking, no unescaping.
And it also now handles C string literals.

`unescape_raw_str` is used for all the non-raw strings.
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 16, 2023

📌 Commit b900eb7 has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 16, 2023
@bors
Copy link
Contributor

bors commented Dec 16, 2023

⌛ Testing commit b900eb7 with merge 3ad8e2d...

@bors
Copy link
Contributor

bors commented Dec 16, 2023

☀️ Test successful - checks-actions
Approved by: fee1-dead
Pushing 3ad8e2d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 16, 2023
@bors bors merged commit 3ad8e2d into rust-lang:master Dec 16, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 16, 2023
@bors bors mentioned this pull request Dec 16, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3ad8e2d): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.1%, 0.8%] 5
Regressions ❌
(secondary)
0.4% [0.2%, 0.7%] 26
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.1%, 0.8%] 5

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
1.1% [0.5%, 1.9%] 3
Regressions ❌
(secondary)
2.7% [2.1%, 3.5%] 3
Improvements ✅
(primary)
-1.2% [-1.8%, -0.6%] 2
Improvements ✅
(secondary)
-3.1% [-3.6%, -2.3%] 3
All ❌✅ (primary) 0.2% [-1.8%, 1.9%] 5

Cycles

Results

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.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
3.8% [3.8%, 3.8%] 1
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.4%, 0.5%] 2

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 672.671s -> 672.699s (0.00%)
Artifact size: 312.49 MiB -> 312.43 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Dec 16, 2023
@lqd
Copy link
Member

lqd commented Dec 16, 2023

This looks most likely to me to be the ongoing noise threshold wiggling on these benchmarks: they should disappear in the next PR we merge.

@nnethercote nnethercote deleted the more-unescaping-cleanups branch December 18, 2023 03:21
@pnkfelix
Copy link
Member

I agree with @lqd; this looks the noise threshold dipped based on a local lull in the amount of noise.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants