Optimize escape_string_symbol()#159609
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Optimize escape_string_symbol()
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (ab58777): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 4.9%, secondary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -5.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 486.168s -> 486.987s (0.17%) |
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Nice find! I wonder if Edit: it doesn't, I tried. |
|
Neat! @bors r+ |
|
Would it be reasonable to bump the priority a bit, given that this seems to be the last PR blocking LLVM 23? 23 gives a nice perf improvement and it would unblock some offload work? Plus, there are some autodiff CI PRs where I have a slight preference to enable them after the bump. @Kobzol |
|
Sure, makes sense. @bors p=1 Blocks LLVM 23 update. |
|
⌛ Testing commit bfe8ccb with merge b803f36... Workflow: https://github.com/rust-lang/rust/actions/runs/29896556061 |
Optimize escape_string_symbol() Going through escape_default() + to_string(), which involves going through formatting machinery and a flat_map of a complex iterator, ends up being quite slow. Directly pushing to a string, even with a naive implementation, is significantly faster. This shows up in the include-blob benchmark, which mostly exercises this one function.
Going through escape_default() + to_string(), which involves going through formatting machinery and a flat_map of a complex iterator, ends up being quite slow. Directly pushing to a string, even with a naive implementation, is significantly faster.
This shows up in the include-blob benchmark, which mostly exercises this one function.