You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wavediff --filter already narrows the signal hierarchy before name/meta/value comparison, but the value-reader side still streamed filtered-out handles and dropped them later. This makes narrow filters correct in output, but less useful on large traces because the reader/channel/buffer path still sees data the user excluded.
This change derives per-reader local include sets from the filtered merged SignalMap and uses them while reading values:
FST readers now pass the selected local handles through FstFilter.include
VCD readers skip non-selected local handles before batching them into the diff channel
multi-file --set1/--set2 offsets are preserved by translating merged handles back to each reader's local handle space
Fixture metrics
Using the existing fixtures as a deterministic scope check:
tests/data/counter.fst: --filter '*.clk' narrows 4 signal names to 1
{set_clk.vcd, set_counter.vcd}: --filter '*.clk' narrows 4 signal names to 1
{set_clk.vcd, set_counter.vcd}: --filter '*.cyc_plus_one' narrows 4 signal names to 1, and the selected handle lives in the second reader, covering non-zero set offsets
After this patch, those narrowed scopes are reflected in the value stream instead of only in the final comparison/output layer.
Validation
cargo build --release
cargo test
cargo clippy -- -D warnings
Thanks. Confirmed that this is way faster for small filter patterns. However, I'm a bit worried about reader_include_sets() in the default case. Does that assemble all the offsets when no -f is given? If so, can we short circuit it when there is no filter?
Good catch — the previous version did build those sets even without -f. I pushed 75c7e74 to short-circuit that path.
reader_include_sets() now compares the retained merged-handle count with the readers' native signal count and returns None when the hierarchy is unfiltered. That propagates as FstFilter.include = None; the VCD path also skips the per-change HashSet lookup entirely. Filtered and match-nothing cases still use explicit per-reader sets.
I added regressions covering the short circuit for single-file FST, single-file VCD, and multi-file VCD inputs. cargo test and cargo clippy --all-targets --all-features -- -D warnings pass locally, and both upstream CI jobs are green on the new commit.
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
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.
Fixes #20.
Summary
wavediff --filteralready narrows the signal hierarchy before name/meta/value comparison, but the value-reader side still streamed filtered-out handles and dropped them later. This makes narrow filters correct in output, but less useful on large traces because the reader/channel/buffer path still sees data the user excluded.This change derives per-reader local include sets from the filtered merged
SignalMapand uses them while reading values:FstFilter.include--set1/--set2offsets are preserved by translating merged handles back to each reader's local handle spaceFixture metrics
Using the existing fixtures as a deterministic scope check:
tests/data/counter.fst:--filter '*.clk'narrows 4 signal names to 1{set_clk.vcd, set_counter.vcd}:--filter '*.clk'narrows 4 signal names to 1{set_clk.vcd, set_counter.vcd}:--filter '*.cyc_plus_one'narrows 4 signal names to 1, and the selected handle lives in the second reader, covering non-zero set offsetsAfter this patch, those narrowed scopes are reflected in the value stream instead of only in the final comparison/output layer.
Validation
I also checked the fixture scope counts with: