reduce perf impact of scalar size checks - #161456
Conversation
|
@bors try |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
try to reduce impact of scalar size checks
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (5e1a5a6): 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 2.1%, secondary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.4%, secondary 6.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 457.604s -> 457.186s (-0.09%) |
|
Looks like the right direction, but not quite enough. So I guess it's code size here, where previously we just constructed a little struct and now we invoke the panic machinery. |
74c6e8a to
8fbb81d
Compare
|
@bors try |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
try to reduce impact of scalar size checks
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (d8dc741): 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 2.9%, secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.6%, secondary -1.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 470.067s -> 467.991s (-0.44%) |
8fbb81d to
ae77f4b
Compare
|
That's at least reasonably close to the red numbers in the original PR I think. |
|
This pull request was unapproved. This PR was contained in a rollup (#161871), which was unapproved. |
ae77f4b to
d802d17
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I doubt that this PR could do anything to affect the scalable vector tests. @bors try jobs=aarch64-gnu |
This comment has been minimized.
This comment has been minimized.
reduce perf impact of scalar size checks try-job: aarch64-gnu
|
Yeah it was the other one. |
…ochenkov reduce perf impact of scalar size checks Attempting to undo the perf regression in rust-lang#161238.
Rollup of 14 pull requests Successful merges: - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #161456 (reduce perf impact of scalar size checks) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`)
…ochenkov reduce perf impact of scalar size checks Attempting to undo the perf regression in rust-lang#161238.
…ochenkov reduce perf impact of scalar size checks Attempting to undo the perf regression in rust-lang#161238.
…uwer Rollup of 21 pull requests Successful merges: - #158609 (Update sccache to 0.16.0) - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160562 (add target feature ABI checks for SPARC) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #161456 (reduce perf impact of scalar size checks) - #161528 (Add regression test to ensure optimal compilation) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161859 (Do not optimize MIR for comptime ConstFns) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - #161889 (Add link to ownership section in ptr::read docs) - #161890 (rustdoc: some clarifying comments) - #161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - #161702 (Use `drop_guard` in some places in {core,alloc,std})
…uwer Rollup of 21 pull requests Successful merges: - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160562 (add target feature ABI checks for SPARC) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #157218 (Track items behind `cfg_select` in the same way we do for `cfg`) - #161456 (reduce perf impact of scalar size checks) - #161528 (Add regression test to ensure optimal compilation) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161859 (Do not optimize MIR for comptime ConstFns) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - #161889 (Add link to ownership section in ptr::read docs) - #161890 (rustdoc: some clarifying comments) - #161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - #161702 (Use `drop_guard` in some places in {core,alloc,std})
Codify the lesson from rust-lang/rust#161456: debug_assert! for internal invariants, #[cold] outlined panics for unavoidable always-on checks in hot paths, and type-level invariants (NonZero* newtypes) over runtime checks.
…n-off, ownership unreachable (#136) * docs: add Gleam/BEAM cross-reference to concurrency plan Annotate docs/dev/concurrency.md with lessons from how Gleam layers typed concurrency APIs (Subject, Selector, process.call, supervisors) over BEAM/ERTS lightweight processes, mapped onto the plan's sections: linked-by-default spawns vs task.scope, composable selectors vs select, dirty schedulers vs the #[blocking]/system-coroutine split, mandatory call timeouts, backpressure advantage of the four channel modes, and the preemptive-vs-cooperative scheduling divergence as a known risk. * docs: trim pipeline_alignment.md to pending work and future considerations All five phases of the Zig-alignment plan have shipped (diagnostics, InternPool, UIR/TIR split, lazy worklist Sema), so the phase-by-phase plan text is removed (preserved in git history). The doc now tracks only the pending substrate features (comptime, generics, inline expansion), the deferred TypeId enum decision (I-018), a new section on divergence from Zig (ownership pass, pre-codegen optimization passes), the one still-valid risk register entry (parallel Sema), and the out-of-scope future considerations. Sweep stale citations to the removed sections in code comments and docs (CLAUDE.md, docs/dev/README.md, architecture_analysis.md, ISSUES.md I-018) so every committed file stays self-contained. * docs: trim view-materialization doc to pending work, schedule gaps on roadmap ryo-view-materialization.md now tracks only the four pending items (slice[T] materialization, From/Materialize + Clone traits, bytes.copy_into, E0034 machine-applicable suggestion); shipped design record lives in roadmap M8.4.1.2/M8.4.2 and final spec 3.4.1. Roadmap: add the slice[T] bit-copy materialization task to M21, the From/Materialize + Clone migration bullet to Traits & Generics, and an E0034 suggestion row to the Phase 5 deferred table. Fix the M8.4.2 completion date (2026-09-01, PR #133) and the README index row. * docs: fold installation.md into roadmap M26.5 and delete the doc The dev doc duplicated Milestone 26.5 almost entirely and was stale (phantom Milestone 20.5, dead ryolang.org URL, false claim that install.sh edits shell rc files). Absorbed its unique content into the roadmap: ~/.ryo/ layout, uninstall procedure, post-v0.1 brew/winget/ Docker distribution, Intel Mac exclusion, ryo upgrade scoping and Windows self-replace caveat. Marked install.sh done with its real behavior, fixed the working install URL and the toolchain.rs path. Musl release artifacts stay gated on the open musl evaluation in ISSUES.md; download integrity is already filed there too. * test: add Python to string_building benchmark Add string_building.py (same 50,000-iteration s += "x" concat loop) and wire python3 into run_benchmarks.sh. Refresh README results: CPython 3.14.7 runs 36.6 ms, ~25x slower than Rust and ~2x slower than Ryo's compiled O(n^2) concat, with 14.72 MB peak RSS. * docs: move pl references to docs/dev/pl_references/ and drop _reference postfix * spec: catch up to M8.4.2, drop println, strip roadmap status - Header: pre-alpha implementation phase; spec holds the final design, implementation status lives in the roadmap - Document shipped bytes/bytesview surface: bytesview in the view-type list, bytes(bview) materialization + W0003, print of bytes/bytesview via escaped repr, owner<->view equality cross-comparison, b"..." in the literal list - Remove println: single print(_ s: str, end: str = "\n") builtin (Python convention); println recorded under Considered/Rejected - Fix stale claims: named/default parameters are not implemented; drop bytes/bytesview from Planned Future Extensions - Spec purity: remove dev-doc citations (final spec Dn/Pn/GAP-n, milestone numbers, docs/dev paths), the Feature Availability rollout table, all Status: Planned banners, and inline v0.x version tags, rewording where the sentence carried design content * chore: track deferred sema INT_MIN/-1 check and FFI audit * fix: guard INT_MIN / -1 and % -1 signed overflow at codegen Extends the division guard with a dividend == i64::MIN && divisor == -1 check branching to the same ryo_panic path; const_int and IntRange elide the check when either side is proven safe. Closes I-138. * docs: add Swift 6.3 pl reference snapshot * fix: split runtime abort paths and make FFI null checks real overflow_abort (u64->usize narrowing, checked_add/mul overflow) and null_abort (null pointer at FFI entry) are now distinct from oom_abort, and ryo_print/ryo_panic/ryo_str_from_view guard their pointer args in release builds too. Closes I-132. * chore: close I-127 after R5 human sign-off Both in-tree unsafe sites carry SAFETY comments and the linked issue, and unsafe_code = deny guards the rest of the tree. Human sign-off recorded 2026-09-01. * refactor: fold ownership param-map panics into trusted-producer contract The four expect("param exists") sites now go through a shared param_idx helper that unreachable!s, matching the sema fallthrough sites under the documented TIR trusted-producer contract. Closes I-155. * chore: move div guard messages to expr.rs to fix file-length check * chore: fix stale emit_div_zero_guard references after rename * test: tighten overflow JIT assertions to require exit 101 * docs: point ownership references at ownership/mod.rs after the split * docs: exempt notes.md from the dev-doc lifecycle, rename from NOTES.md Also tracks the remaining hyphenated ryo-*.md doc names as I-168. * docs: fix pl_references phase counts, codegen pipeline, and spec links * docs: gate shared[T] on ARC optimizer pass, name freezing rule - spec 5.6: promote 'sharing freezes' to the named Freezing concept; add weak[T]-by-default guidance and demote unowned[T] to provable lifetimes only (runtime-trap warning) - roadmap: ARC optimizer is a hard gate for user-visible shared[T] (M22 prototype, before stdlib/benchmarks); add debug-mode shared[T] cycle detector to the Phase 5 gap table (semantics unchanged) - concurrency.md: fold channel modes, cancellation sources, async destructors, memory model, and with-block guard rules into spec pointers (9.2.2/9.2.5/9.2.6/9.3.2/14.5.4) - spec: channel mode table, try_send/try_recv, close semantics, 9.2.6 memory model, async destructors, cancel/cancel_now contract * docs: refresh architecture analysis, absorb superseded dev docs into spec - architecture_analysis.md: refresh to 2026-08-24 snapshot (fix/file-length-gate @ 333dbca); delete the dated 2026-08-20/2026-08-24 snapshots (history in git) - unsafe.md, design_issues.md, testing.md, built_in.md, std.md, considerations.md, closure_representation.md: drop content now owned by the spec; keep status headers pointing at the owning spec sections - docs/dev/CLAUDE.md: drop stale milestone-dependency list, note notes.md exemption from the dev-doc lifecycle * docs: add R18a rule on keeping panicking checks out of hot paths Codify the lesson from rust-lang/rust#161456: debug_assert! for internal invariants, #[cold] outlined panics for unavoidable always-on checks in hot paths, and type-level invariants (NonZero* newtypes) over runtime checks.
View all comments
Attempting to undo the perf regression in #161238.