Repository navigation
perf: vein census 3 -- nine deterministic wins from real-program profiles - #51
Merged
Merged
Conversation
…iles Census by function on real programs (perl, sqlite, lua, python, Endless Sky start-up) and the Rust GlobalAlloc workloads; docs/opps.md "Vein census 3". Allocator Ir vs 2.2.5, outputs identical: Endless Sky -6.85 %, lua -2.23 %, perl -1.64 %, sqlite -0.11 %; Rust overaligned -4.24 %, threads -1.53 %, maps -0.36 %. Peak RSS within +-0.4 %. 1. page_extend carves in geometric batches (at least what the page holds): the slow-path trips, not the 2.75 Ir/block linking, were the cost. ES -4.50 %. A fixed 8 KiB batch cost thread life +10 % (refuted). 2. C exports test the owner before the page flags, so a cross-thread free into a FULL page goes straight to remote_free (ES -515 k, xthread -2.9 %). Rust's dealloc keeps the 2.2.5 order (free_inline_flags_first): the bigger remote arm stopped __rust_dealloc inlining into drop glue (trees +2.88 %). Trade: a local free into a slow page +2 Ir. 3. GlobalAlloc::alloc: only the natural-alignment arm out of line (it was a second inlined malloc copy). maps -0.33 %, overaligned -1.81 %. 4. SMALL_BIN table for the generic path's bin, by the word count it already computes. ES -0.70 % and more. 5. malloc_or_with::<H: OnOom>: operator new's cold arm frame 12 -> 7. ES -419 k. 6. realloc_live hands its resolved page to the free (lua -60 k). 7. An 8-slot heap-box cache (upstream TD_CACHE_SIZE): no mmap/munmap pair per thread. Thread life -1.1 %, minor faults -15 %. 8. #[inline] usable_size: over-aligned Rust realloc -2.06 %. 9. MSVC + panic=unwind: sub/setle into an output operand, +2 over the goto where 2.2.5's plain decrement was +3. Still 0 callbr there. 10. Thread-exit collect: refuted as inherent (the cross-thread drain). Gates: workspace --all-features 177/177, linux-gates 42/0, embedded 15/15, clippy (Windows + Linux), fmt, semgrep, wasm self-test + size, gate self-test, miri gate + openheimer 37/37, mimalloc-bench 19/19, churn 5/5, real-world outputs identical across ra/mi/sys, alloc-eval 8 traces, rusty_sloth built with crates.io identity (--release --features cuda). Unsafe census 981 -> 994 (UNSAFE.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cargo fmt rewrote init.rs (the repo's one CRLF file) to LF in the previous commit, which buried its 52-line change in a 2,547-line diff. Restored; cargo fmt --check accepts either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Census by function on real programs (perl, sqlite, lua, python, Endless Sky start-up) and the Rust
GlobalAllocworkloads, then each vein probed, measured paired in one session, and kept or refuted. Full table:docs/opps.md→ "Vein census 3".Allocator instructions vs 2.2.5 (callgrind, outputs identical)
Rust whole-program: overaligned −4.24 %, threads −1.53 %, maps −0.36 %, trees flat. Peak RSS within ±0.4 %.
Landed: geometric page-extension batches (the biggest); owner-first test order for the C
free/operator deleteexports, with Rust'sdeallockeeping the 2.2.5 order (split body, two symbols); one inlined malloc inGlobalAlloc::alloc; a small-size bin table; a typed OOM handler foroperator new(frame 12 → 7); single page resolution in a movingrealloc; an 8-slot heap-box cache (nommap/munmapper thread);#[inline]usable_size; asub/setlearm for MSVC +panic = "unwind"(still 0callbr).Known trade: a same-thread free into a slow page (large span, huge, aligned, full) pays the owner compare first: +2 Ir on opscan's 2 MiB (142 → 144) and 64 MiB (834 → 836) ops.
Refuted and recorded: a fixed 8 KiB batch (thread life +10 %), three other shapes of the
allocsplit, two other shapes of the remote arm, and the thread-exit collect (inherent).Validated: workspace
--all-features177/177, linux-gates 42/0, embedded 15/15, clippy Windows + Linux, fmt, semgrep, wasm self-test + size, gate self-test, miri gate +openheimer37/37, mimalloc-bench 19/19, churn 5/5, real-world programs identical across ra/mi/sys, alloc-eval (8 traces), rusty_sloth--release --features cudawith crates.io identity. New public items:alloc::malloc_or_with,alloc::OnOom,alloc::free_inline_flags_first(additive). Unsafe census 981 → 994, each inUNSAFE.md.🤖 Generated with Claude Code