-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[rustc_data_structures][base_n][perf] Remove unnecessary utf8 check. #114339
Conversation
Since all output characters taken from `BASE_64` are valid UTF8 chars there is no need to waste cycles on validation. Even though it's obviously a perf win, I've also used a [benchmark](https://gist.github.com/ttsugriy/e1e63c07927d8f31e71695a9c617bbf3) on M1 MacBook Air with following results: ``` Running benches/base_n_benchmark.rs (target/release/deps/base_n_benchmark-825fe5895b5c2693) push_str/old time: [14.670 µs 14.852 µs 15.074 µs] Performance has regressed. Found 11 outliers among 100 measurements (11.00%) 4 (4.00%) high mild 7 (7.00%) high severe push_str/new time: [12.573 µs 12.674 µs 12.801 µs] Performance has regressed. Found 11 outliers among 100 measurements (11.00%) 7 (7.00%) high mild 4 (4.00%) high severe ```
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
let's see whether this has a perf impact in the big picture |
⌛ Trying commit 64dfd10 with merge 54dae55966c4fd1e2fffedc9a1c6a16d6df6f073... |
Some years ago i tried something similar #86214 |
☀️ Try build successful - checks-actions |
it seems likely to me that the perf impact will be negligible (actually this code might be off by default and only used in v0 mangling) but even then, I'd expect it to not matter that much. That said, the safety invariant here is trivial to uphold as it always writes ASCII bytes so it's not that problematic. |
oops, wrong command |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (54dae55966c4fd1e2fffedc9a1c6a16d6df6f073): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking 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 Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: missing data |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (617821a): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 634.018s -> 633.541s (-0.08%) |
Since all output characters taken from
BASE_64
are valid UTF8 chars there is no need to waste cycles on validation.Even though it's obviously a perf win, I've also used a benchmark on M1 MacBook Air with following results: