Claude/optimize merge message worker#81
Merged
Merged
Conversation
The merge dominated by copy.deepcopy of the entire accumulator kgraph on every merge_kgraph call, plus heavy hashing for unique-attribute dedupe. On a synthetic 1000-result merge: 1.76s -> 0.16s (~11x). - merge_kgraph: mutate og_message in place. Caller is an accumulator that discards og_message after each call, and merge_messages discards both input messages after merging, so reference adoption is safe. - merge_kgraph: for newly-adopted edges, append the aggregator source if not already present instead of running combine_unique_dicts on every one (typically 3-element source lists; was the worst per-edge cost). - combine_unique_dicts: replace the recursive Python make_hashable with json.dumps(..., sort_keys=True, default=str). C-implemented, faster, and fixes a latent bug where non-string lists silently dropped from the signature. - recursive_get_edge_support_graphs / recursive_get_auxgraph_edges: add visited-set short-circuit. Without it, shared aux graphs caused redundant (potentially exponential) re-traversal in filter_kgraph_orphans. - merge_messages: drop the per-aux-graph deepcopy; inputs are discarded after merge. - queries_equivalent: normalize via shallow-copied dicts instead of deepcopy of the whole query graph.
Codecov Report❌ Patch coverage is
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.
No description provided.