Skip to content

Conversation

Zalathar
Copy link
Contributor

(Slightly modified version of the original experiment at #146804.)

This works because the only characters we care about escaping are ASCII characters, so forwarding non-ASCII UTF-8 bytes as-is still produces correct results.

A perf run at #146804 (comment) indicates that this has a big impact on several versions of the large-workspace benchmark.


This PR doesn't address the underlying problem, which is that we're doing this quoting far too many times overall. Really we shouldn't be doing it more than once per process, but in practice we do it multiple times per CGU, which is bad news for incremental builds.

But these changes are basically a free win, so I'm happy to merge them anyway.

This works because the only characters we care about escaping are ASCII
characters, so forwarding non-ASCII UTF-8 bytes as-is still produces correct
results.
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Sep 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

r? @petrochenkov

rustbot has assigned @petrochenkov.
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

@Zalathar
Copy link
Contributor Author

I did make some tweaks since the original experiment (pre-computing a buffer size and re-validating the output), so let's do another perf run.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 24, 2025
cg_llvm: Perform target-machine command-line quoting as bytes, not characters
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 24, 2025
@rust-bors
Copy link

rust-bors bot commented Sep 24, 2025

☀️ Try build successful (CI)
Build commit: 341189b (341189b5f9cbc286c17fbfc1309105ccf8051986, parent: ae12bc21d8ec76bbb753d4da168e9b08e1b09ebf)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (341189b): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.5% [-8.8%, -0.2%] 10
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-3.7%, -1.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.2% [-3.7%, 2.0%] 4

Cycles

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

Binary size

Results (secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

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

Bootstrap: 470.741s -> 469.606s (-0.24%)
Artifact size: 387.87 MiB -> 387.89 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants