Improve polymorphization of raw pointer formatting#157714
Conversation
This reduces the amount of LLVM IR rustc generates for basically every use of `fmt::Pointer` by several hundred lines per pointee type. Most of the gain is from side-stepping a code size issue with the current implementation of `Formatter::with_field`. But even if those were fixed, it would still be an improvement: * The "is it a thin pointer?" check can't be eliminated during codegen, so rustc codegens *both* branches for every pointer type and LLVM has to clean it up later. * For wide pointers, the use of `DebugStruct` isn't a *lot* of code, but it's still a bit of extra code per wide pointer type that can easily be shared across all wide pointer types.
|
Failed to set assignee to
|
|
r? @LawnGnome rustbot has assigned @LawnGnome. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
|
❌ Encountered an error while executing command |
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Improve polymorphization of raw pointer formatting
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8a88eb6): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (primary -2.3%, secondary -2.6%)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: 517.481s -> 518.904s (0.27%) |
|
Makes sense to me. Nice work! @bors r+ rollup=never (given perf implications) |
This comment has been minimized.
This comment has been minimized.
Improve polymorphization of raw pointer formatting This reduces the amount of LLVM IR rustc generates for basically every use of `fmt::Pointer` by several hundred lines per pointee type. Most of the gain is from side-stepping a code size issue with the current implementation of `Formatter::with_field`. But even if those were fixed, it would still be an improvement: * The "is it a thin pointer?" check can't be eliminated during codegen, so rustc codegens *both* branches for every pointer type and LLVM has to clean it up later. * For wide pointers, the use of `DebugStruct` isn't a *lot* of code, but it's still a bit of extra code per wide pointer type that can easily be shared across all wide pointer types.
|
💔 Test for d390a19 failed: CI. Failed job:
|
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
@bors retry |
|
@bors rollup=iffy |
|
⌛ Testing commit c043f23 with merge be2c792... Workflow: https://github.com/rust-lang/rust/actions/runs/27461008959 |
Improve polymorphization of raw pointer formatting This reduces the amount of LLVM IR rustc generates for basically every use of `fmt::Pointer` by several hundred lines per pointee type. Most of the gain is from side-stepping a code size issue with the current implementation of `Formatter::with_field`. But even if those were fixed, it would still be an improvement: * The "is it a thin pointer?" check can't be eliminated during codegen, so rustc codegens *both* branches for every pointer type and LLVM has to clean it up later. * For wide pointers, the use of `DebugStruct` isn't a *lot* of code, but it's still a bit of extra code per wide pointer type that can easily be shared across all wide pointer types.
|
yielding to encompassing rollup @bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #157852. |
Rollup of 10 pull requests Successful merges: - #157714 (Improve polymorphization of raw pointer formatting) - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157594 (note which target a missing target_feature belongs to) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
|
⌛ Testing commit c043f23 with merge c180c64... Workflow: https://github.com/rust-lang/rust/actions/runs/27461267747 |
Improve polymorphization of raw pointer formatting This reduces the amount of LLVM IR rustc generates for basically every use of `fmt::Pointer` by several hundred lines per pointee type. Most of the gain is from side-stepping a code size issue with the current implementation of `Formatter::with_field`. But even if those were fixed, it would still be an improvement: * The "is it a thin pointer?" check can't be eliminated during codegen, so rustc codegens *both* branches for every pointer type and LLVM has to clean it up later. * For wide pointers, the use of `DebugStruct` isn't a *lot* of code, but it's still a bit of extra code per wide pointer type that can easily be shared across all wide pointer types.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #157852. |
Rollup of 10 pull requests Successful merges: - #157714 (Improve polymorphization of raw pointer formatting) - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157594 (note which target a missing target_feature belongs to) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
Rollup merge of #157714 - hanna-kruppe:fmt-pointer, r=LawnGnome Improve polymorphization of raw pointer formatting This reduces the amount of LLVM IR rustc generates for basically every use of `fmt::Pointer` by several hundred lines per pointee type. Most of the gain is from side-stepping a code size issue with the current implementation of `Formatter::with_field`. But even if those were fixed, it would still be an improvement: * The "is it a thin pointer?" check can't be eliminated during codegen, so rustc codegens *both* branches for every pointer type and LLVM has to clean it up later. * For wide pointers, the use of `DebugStruct` isn't a *lot* of code, but it's still a bit of extra code per wide pointer type that can easily be shared across all wide pointer types.
View all comments
This reduces the amount of LLVM IR rustc generates for basically every use of
fmt::Pointerby several hundred lines per pointee type. Most of the gain is from side-stepping a code size issue with the current implementation ofFormatter::with_field. But even if those were fixed, it would still be an improvement:DebugStructisn't a lot of code, but it's still a bit of extra code per wide pointer type that can easily be shared across all wide pointer types.