-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Optimize io::Write::write_fmt
for constant strings
#138650
Conversation
When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`. Also, match the convention of `fmt::Write` for the name of `args`.
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
This change is extracted from #137762 and does not use Can we do a perf run? |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Optimize `io::Write::write_fmt` for constant strings When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`. Also, match the convention of `fmt::Write` for the name of `args`.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8b7fc8c): comparison URL. Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -2.0%, secondary 0.2%)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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary 0.1%)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.
Bootstrap: 776.409s -> 774.964s (-0.19%) |
This is a runtime thing, so I'm not surprised we're not seeing any change in the compile time benchmarks. I think that means we're good. |
The benchmarks measure the run time of the compiler. It seems unlikely to use |
…ibraheemdev Optimize `io::Write::write_fmt` for constant strings When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`. Also, match the convention of `fmt::Write` for the name of `args`.
Rollup of 15 pull requests Successful merges: - rust-lang#138321 ([bootstrap] Distribute split debuginfo if present) - rust-lang#138364 (ports the compiler test cases to new rust_intrinsic format) - rust-lang#138410 (Couple mir building cleanups) - rust-lang#138435 (Add support for postfix yield expressions) - rust-lang#138536 (stable_mir: Add `MutMirVisitor`) - rust-lang#138623 ([bootstrap] Use llvm_runtimes for compiler-rt) - rust-lang#138650 (Optimize `io::Write::write_fmt` for constant strings) - rust-lang#138652 (Reintroduce remote-test support in run-make tests) - rust-lang#138685 (Use `Option<Ident>` for lowered param names.) - rust-lang#138694 (Fix: add ohos target notes) - rust-lang#138700 (Suggest `-Whelp` when pass `--print lints` to rustc) - rust-lang#138709 (Update GCC submodule) - rust-lang#138724 (Check attrs: Don't try to retrieve the name of list stems) - rust-lang#138731 (coverage: Add LLVM plumbing for expansion regions) - rust-lang#138732 (Use `def_path_str` for def id arg in `UnsupportedOpInfo`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#137357 (Document results of non-positive logarithms) - rust-lang#138650 (Optimize `io::Write::write_fmt` for constant strings) - rust-lang#138694 (Fix: add ohos target notes) - rust-lang#138713 (interpret memory access hooks: also pass through the Pointer used for the access) - rust-lang#138724 (Check attrs: Don't try to retrieve the name of list stems) - rust-lang#138743 (bootstrap: add `--ci` flag) - rust-lang#138751 (Fix the "used_with_archive" test on Fuchsia) - rust-lang#138754 (Handle spans of `~const`, `const` and `async` trait bounds in macro expansion) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#138650 - thaliaarchi:io-write-fmt-known, r=ibraheemdev Optimize `io::Write::write_fmt` for constant strings When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`. Also, match the convention of `fmt::Write` for the name of `args`.
When the formatting args to
fmt::Write::write_fmt
are a statically known string, it simplifies to only callingwrite_str
without a runtime branch. Do the same inio::Write::write_fmt
withwrite_all
.Also, match the convention of
fmt::Write
for the name ofargs
.