Skip to content

Adding WriteZipper::remove_subtrie - #162

Merged
luketpeterson merged 2 commits into
masterfrom
remove_subtrie_api_addition
Oct 13, 2026
Merged

luketpeterson merged 2 commits into
masterfrom
remove_subtrie_api_addition

Conversation

@luketpeterson

@luketpeterson luketpeterson commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Adding WriteZipper::remove_subtrie as this is a more fundamental operation than remove_branches, but remove_branches is useful and correct in its own right.

This new method balances the API, helping define and explain the consistency fixes proposed in #104 Also, in the future this will be the lowest-cost way to just chop a subtrie, although the current implementation doesn't offer much perf benefit vs. remove_branches.

I also updated the lean model to include the new method. However, this shifted the number of opcodes and threatened to invalidate the existing .bin files. So I made a change to the .bin header to include the opcode count, rather than hard-coding the %56 that was in there.

I pondered going further and actually redoing the .bin format entirely, storing opcodes + args instead of the raw fuzz signal, so decoding only happens once before saving a reproduction - but I didn't go that far because it seemed unnecessary and like I'd be over-stepping.

Thoughts, @imlvts?

…ation than remove_branches, but remove_branches is useful and correct in its own right.

Updating documentation
Future-proofing fuzzer .bin format by carrying opcode count in header
@luketpeterson
luketpeterson requested a review from imlvts October 9, 2026 03:09
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Bench A/B vs base: done

job log · 2026-10-13 01:59:26 UTC

base cb4e1e4 → head d8597a2, 3 round(s), median of each run averaged; negative is faster

bench cases geomean largest gain largest loss >5% faster >5% slower
shakespeare 7 +4.5% -1.3% shakespeare/shakespeare_words_insert +23.1% shakespeare/shakespeare_sentences_val_count 0 2
cities 5 -0.1% -2.0% cities/cities_val_count +2.6% cities/cities_get 0 0
sparse_keys 96 -0.5% -4.0% binary_drop_head/50 +4.8% sparse_iter/10 0 0
binary_keys 77 +0.7% -4.3% binary_meet/400 +31.1% binary_zipper_iter/50 0 6
superdense_keys 104 -0.9% -13.0% superdense_drop_head/1000 +7.6% superdense_meet_after_join/1000 4 1
act_paths 46 -1.5% -11.5% shape_map_to_act_cata/random_long +2.8% size_map_to_paths/100000 5 0
zipper_head_owned 16 -0.3% -2.7% zipper_head_owned/owned_head_read_creation +1.3% zipper_head_owned/map_reader_is_val 0 0
product_zipper 4 -0.8% -1.5% product_zipper/generic_act_act +1.1% product_zipper/generic_pathmap_act 0 0
18 case(s) moved more than 5%
bench case base head change
binary_keys binary_zipper_iter/50 1.19 µs 1.56 µs +31.1%
binary_keys binary_zipper_iter/100 2.32 µs 2.96 µs +27.8%
binary_keys binary_zipper_iter/200 4.58 µs 5.73 µs +25.2%
binary_keys binary_zipper_iter/400 8.89 µs 11.05 µs +24.3%
binary_keys binary_zipper_iter/1600 34.02 µs 42.21 µs +24.1%
binary_keys binary_zipper_iter/800 17.29 µs 21.37 µs +23.6%
shakespeare shakespeare/shakespeare_sentences_val_count 2.63 ms 3.24 ms +23.1%
superdense_keys superdense_drop_head/1000 17.23 µs 15.00 µs -13.0%
act_paths shape_map_to_act_cata/random_long 44.29 ms 39.20 ms -11.5%
superdense_keys superdense_drop_head/2000 23.17 µs 20.85 µs -10.0%
act_paths shape_map_to_act_cata/clustered 9.14 ms 8.30 ms -9.2%
shakespeare shakespeare/shakespeare_words_val_count 304.30 µs 331.37 µs +8.9%
act_paths shape_map_to_act_cata/dense_wide 9.44 ms 8.61 ms -8.9%
act_paths shape_map_to_act_cata/dense_narrow 10.92 ms 9.96 ms -8.8%
superdense_keys superdense_meet_after_join/1000 9.14 µs 9.84 µs +7.6%
act_paths shape_map_to_act_cata/small_alphabet 10.94 ms 10.19 ms -6.8%
superdense_keys superdense_drop_head/4000 29.36 µs 27.47 µs -6.4%
superdense_keys superdense_drop_head/8000 42.05 µs 39.63 µs -5.8%

Full tables per bench are in the job log and the bench-out artifact.

@Adam-Vandervorst

Adam-Vandervorst commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

I believe this is good iff it's upheld by a lot of laws.
Such as being equivalent to remove_branches ; remove val or restrict(PathMap::new())

@luketpeterson

Copy link
Copy Markdown
Collaborator Author

I believe this is good iff it's upheld by a lot of laws.
Such as being equivalent to remove_branches ; remove val or restrict(PathMap::new())

Yup. The former is even codified in the default impl as well as the lean model.

@imlvts

imlvts commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

mostly good, but I think: ditch the --input-header CLI argument.
when writing, always write the most recent header applicable.
when reading, auto-detect the format by the presence of the magic string.

@luketpeterson
luketpeterson merged commit ef02591 into master Oct 13, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants