Skip to content

Claude/optimize merge message worker#81

Merged
maximusunc merged 3 commits into
mainfrom
claude/optimize-merge-message-worker-VgZzn
May 8, 2026
Merged

Claude/optimize merge message worker#81
maximusunc merged 3 commits into
mainfrom
claude/optimize-merge-message-worker-VgZzn

Conversation

@maximusunc
Copy link
Copy Markdown
Collaborator

No description provided.

claude and others added 3 commits May 6, 2026 20:57
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
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 41.88034% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.49%. Comparing base (51c0931) to head (4b1f9c5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
shepherd_utils/shared.py 41.42% 30 Missing and 11 partials ⚠️
workers/merge_message/worker.py 42.55% 18 Missing and 9 partials ⚠️
Files with missing lines Coverage Δ
workers/merge_message/worker.py 44.59% <42.55%> (+1.61%) ⬆️
shepherd_utils/shared.py 47.14% <41.42%> (+1.56%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7416186...4b1f9c5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maximusunc maximusunc merged commit a3da603 into main May 8, 2026
2 checks passed
@maximusunc maximusunc deleted the claude/optimize-merge-message-worker-VgZzn branch May 8, 2026 17:41
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.

2 participants