Arc: Remove unnecessary fmt::Display use for overflow assertion - #160731
Arc: Remove unnecessary fmt::Display use for overflow assertion#160731fereidani wants to merge 1 commit into
Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 0ec97c2 with merge babfadb… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/31240262676 |
Arc: Remove unnecessary fmt::Display use for overflow assertion
|
Note that I think we probably don't excercise this codepath very much in the compiler, so we probably won't see much impact in rustc-perf benchmarks. Are you trying to optimize something specific in the compiler or what's the reason you want to run perf on this? |
This PR removes unnecessary
fmt::Displaygenerated assembly because of use of formatting in the overflow check assertion(assert!(n <= MAX_REFCOUNT, "{}", INTERNAL_OVERFLOW_ERROR);).This reduces generated x64 assembly for counter increment(simplified) from:
To:
Godbolt link:
https://godbolt.org/z/3qjxooYWM
I expect bors to report a binary size reduction for all programs using Arc. There might also be performance improvements as a byproduct of CPU cache hit increase.