-
Notifications
You must be signed in to change notification settings - Fork 0
docs(changelog): appstate scan-dedup refactor (whatsapp-rust#865) #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| title: "June 14, 2026 — App state: linear scan replaces HashSet for index-mac dedup" | ||
| description: "detect_duplicate_index_in_patch and HashState::update_hash now use Vec linear scans instead of HashSet for index_mac dedup, reducing wacore_appstate .text by −1.1 KiB (−3.03%) and eliminating one HashSet allocation per patch." | ||
| --- | ||
|
|
||
| ## Internal / Binary size | ||
|
|
||
| **App state: `Vec` linear scan replaces `HashSet` for `index_mac` dedup ([#865](https://github.com/oxidezap/whatsapp-rust/pull/865))** | ||
|
|
||
| Two `HashSet<&[u8]>` usages in the patch-validation path are replaced with linear-scan `Vec<&[u8]>`: | ||
|
|
||
| 1. `detect_duplicate_index_in_patch` (`processor.rs`) — the in-patch duplicate-index guard, tracking Set and Remove independently. | ||
| 2. `HashState::update_hash`'s `removed_in_patch` (`hash.rs`) — the membership set that gates the SET-also-REMOVEd double-subtract. | ||
|
|
||
| `index_mac` blobs are HMAC outputs — uniformly random bytes — so SipHash's distribution properties buy nothing over a byte compare; the only cost was per-key hash setup and a `HashMap` table allocation. This is the same trade-off measured for `collect_unique_index_macs` in #856, where `HashSet` was **6–120% slower** than linear scan at patch sizes seen in practice (N≈10–50). | ||
|
|
||
| **Binary size impact (`wacore_appstate` `.text`):** | ||
|
|
||
| | Before | After | Δ | | ||
| |---:|---:|---:| | ||
| | ~36.3 KiB | ~35.2 KiB | **−1.1 KiB (−3.03%)** | | ||
|
|
||
| The reduction comes from dropping the monomorphized `HashSet`/SipHash machinery from the compiled output. CodSpeed reports no performance change across all 172 benchmarks — the dedup is microscopic next to the crypto operations (SHA-256 `compress256`, lthash HKDF) that dominate the patch benchmark. | ||
|
|
||
| ## Breaking changes | ||
|
|
||
| None. Behaviour is byte-for-byte identical; the existing tests (`process_patch_rejects_duplicate_set_index`, `process_patch_allows_same_index_across_set_and_remove`, and the `update_hash` index-mode tests) cover both paths and are unchanged. | ||
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.
Uh oh!
There was an error while loading. Please reload this page.