Repository navigation
Conversation
With the lazily grown item buffer (0.4.0), compress_while_updating had a single call site left in push_value, so it was inlined there; push_value grew to about 2.3 KB and stopped inlining into update's callers, and a 50M-update stream ran about 10% slower (34.7 vs 31.1 ns/update at k = 469). compress_while_updating is #[inline(never)] again; push_value inlines and the stream runs at 32.5 ns/update. - kll/wire.rs: the decoder comment claimed a decoded sketch's level array is identical to the source's; only the boundaries relative to the first retained item match. - UnivMon::check_shape: more than MATRIX_MAX_ROWS rows build in memory but to_asapv1 refuses them; a caller that needs an encodable state must check the row count too.
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.
Why
Review follow-ups to the lazily grown KLL item buffer that #242 brought to main (from #238), plus one doc fix on
UnivMon::check_shape:#[cold]make_room, which leftcompress_while_updatingwith a single call site inpush_value. The compiler inlined it there.push_valuegrew to about 2.3 KB and stopped inlining intoupdate's callers.nmon the two release builds showspush_valueas its own 2,348-byte symbol on 0.4.0, and absent (inlined) before.UnivMon::check_shape's doc. More thanMATRIX_MAX_ROWSrows pass the check and build in memory, butto_asapv1refuses them. The doc did not say so.What
Kll::compress_while_updatingis#[inline(never)]. It runs once per level-0 fill, so keeping it out of line costs nothing on the hot path, andpush_valueinlines again.src/sketches/kll/wire.rs: the decoder comment states what matches.UnivMon::check_shapedoc: a pyramid with more thanMATRIX_MAX_ROWSrows builds but cannot be encoded. Callers that need an encodable state must check the row count.The other review items are already on main: the decoder's dead
offsetis gone (cursorstarts at 0), andlazy_allocation_matches_eager_across_lifecyclecomparesclear(), decode-then-update and merge against the eager reference. The CHANGELOG blank-line and line-length nits were in #238's own text, which #242 did not carry over.How
One attribute and doc text; no behavior change. Retained items, coin tosses and ASAPv1 bytes are unchanged; the existing eager-equality and golden tests cover them.
Before
After
Verification
Benchmark: a local example, not committed. It runs a 50M-update stream with xorshift input and
with_seed(k, 8, 7), and creates 1,000,000 KLLs (k = 469) with 10 updates each, held 10,000 at a time. Release build, pinned to one core (taskset -c 50), the three builds alternated in each round, 7 rounds. The host was shared and its load swung from 22 to 70 during the session. Rounds 2–4 had the lowest load, and all three builds were stable within 2% in them; the numbers are their ranges:Remaining gap: within 4% of 60101c6 at k = 469 under that load (main: 10–11%), within noise at k = 200; a review run on a quieter host measured parity. The CHANGELOG uses the same figure. The lazy buffer's 15× creation speedup is kept.
Checks:
cargo fmt --all -- --check; clippy-D warningswith--all-features, default features,octo-runtimeandexperimental;cargo test --all-features --locked(2,233 passed) andcargo test --locked(1,977 passed);RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --locked.