Skip to content

Get rid of EscapeDebugInner. #138237

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

reitermarkus
Copy link
Contributor

I read the note on EscapeDebugInner and thought I'd give it a try.

@rustbot
Copy link
Collaborator

rustbot commented Mar 8, 2025

r? @thomcc

rustbot has assigned @thomcc.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 8, 2025
@reitermarkus reitermarkus force-pushed the remove-escape-debug-inner branch 3 times, most recently from 57c0a80 to 0854482 Compare March 8, 2025 20:52
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@reitermarkus reitermarkus requested a review from hkBst March 10, 2025 17:43
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@hkBst
Copy link
Member

hkBst commented Mar 11, 2025

-        // SAFETY: `self.data.escape_seq` contains an escape sequence, as is 
-        // guaranteed by the caller, and in that case `self.alive` is guaranteed 
+        // SAFETY: `self.data.escape_seq` contains an escape sequence, as is
+        // guaranteed by the caller, and in that case `self.alive` is guaranteed

I'm sure you know this, but if you highlight these lines, you can see that the trailing space is the problem.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 1, 2025
@hkBst
Copy link
Member

hkBst commented Apr 2, 2025

@thomcc I think it would make sense to see the perf impact of this change, since it is supposed to be an optimization (and increases the use of unsafe). Otherwise it seems hard to determine if this is a worthy trade-off.

@reitermarkus
Copy link
Contributor Author

reitermarkus commented Apr 27, 2025

r? libs

@rustbot
Copy link
Collaborator

rustbot commented Apr 27, 2025

Error: Parsing assign command in comment failed: ...'' | error: specify user to assign to at >| ''...

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@rustbot rustbot assigned tgross35 and unassigned thomcc Apr 27, 2025
@tgross35
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 27, 2025
@bors
Copy link
Collaborator

bors commented Apr 27, 2025

⌛ Trying commit 8b1d999 with merge 174fdb8...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2025
…er, r=<try>

Get rid of `EscapeDebugInner`.

I read the note on `EscapeDebugInner` and thought I'd give it a try.
@bors
Copy link
Collaborator

bors commented Apr 27, 2025

☀️ Try build successful - checks-actions
Build commit: 174fdb8 (174fdb8cd5ea329d04af0f4ab8064f1c849bda29)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (174fdb8): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking 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
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary -0.4%, secondary 2.8%)

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.8% [0.6%, 3.9%] 3
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
-1.8% [-4.1%, -0.4%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-4.1%, 3.9%] 8

Cycles

Results (primary -0.5%, secondary 1.5%)

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
Regressions ❌
(secondary)
2.5% [2.2%, 2.7%] 4
Improvements ✅
(primary)
-0.5% [-0.6%, -0.5%] 2
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) -0.5% [-0.6%, -0.5%] 2

Binary size

Results (primary -0.0%, 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 4
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 35
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 4

Bootstrap: 762.088s -> 762.832s (0.10%)
Artifact size: 365.14 MiB -> 365.11 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 27, 2025
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, this looks reasonably good to me but I want to be sure I understand the design first.

Comment on lines +163 to +164
pub escape_seq: [ascii::Char; N],
pub literal: char,
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the value of this being a union? Assuming N >= 4, it seems like any chars could just be written to escape_seq to eliminate the union unsafety.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ascii::Char only ranges from 0 to 127. So you would have to store both in [u8; N] instead, and transmute both variants.

@tgross35
Copy link
Contributor

tgross35 commented Jun 3, 2025

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2025
@reitermarkus reitermarkus force-pushed the remove-escape-debug-inner branch from 8b1d999 to 703b285 Compare June 4, 2025 20:28
@rust-log-analyzer

This comment has been minimized.

@reitermarkus reitermarkus force-pushed the remove-escape-debug-inner branch from 703b285 to 7ef10fc Compare June 4, 2025 21:57
@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants