Repository navigation
Conversation
During deserialization all keys in the stream are unique by construction, so the full emplace path (findCell, which checks keyEquals on every probe step) is wasteful. Switch to insertForDeserialization, a new helper that calls insertUniqueNonZero for non-zero keys (findEmptyCell only checks isZero, not keyEquals) and copies directly into zeroValue storage for the zero key. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
size() previously summed all 256 bucket sizes on every call; empty() scanned until it found a non-empty bucket. Add a tracked m_size member: - incremented in emplace when inserted = true - recounted after constructors and read/readText that call insertUniqueNonZero directly, bypassing emplace size() and empty() are now O(1). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This reverts commit c991edf.
The two insertIfNotPresent overloads were default-constructing Mapped and then copy-assigning the actual value, performing two operations where one suffices. Replace with a single placement-new that constructs Mapped directly from the argument. For non-trivial Mapped types this avoids the unnecessary default construction. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [ed28371] Summary: ✅ AI ReviewSummaryThis PR optimizes hash table deserialization by avoiding key-equality checks on insert and by constructing ClickHouse Rules
Final Verdict
|
HashMapCellWithSavedHash::read does not deserialize saved_hash, so calling x.getHash(*this) on a freshly deserialized cell reads an uninitialized field - undefined behaviour and wrong bucket placement. Fix: take the cell by value, compute the hash from the key via Hash::operator(), and call setHash before copying the cell into the buffer. This ensures saved_hash is valid for both the keyEquals fast-path and reinsert during any subsequent resize. For cells without a saved hash, setHash is a no-op so there is no behaviour change. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 task done
Contributor
LLVM Coverage Report
Changed lines: 100.00% (20/20) · Uncovered code |
1 task done
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
todo