gabriel / musehub public
perf minor task/push-perf-2 #1 / 1
gabriel · 60 days ago · Apr 8, 2026 · Diff

perf: O(N) topological sort + bulk snapshot INSERT in wire_push

_topological_sort used queue.pop(0) on a list — O(N) per pop, O(N²) total. Replaced with collections.deque.popleft() → O(N).

bulk_upsert_snapshot_entries was re-processing existing snapshots on every push (DELETE + re-INSERT entries for content-addressed data that never changes). Now skips snapshots that already exist on the server. Also replaces N session.add() calls with a single Core insert() bulk statement.

Result: 51-commit push_pack 0.946s → 0.139s (6.8x faster).

sha256:bdd4e443023e40c96785778cad2b6947a5ec7a3fb0e628cfc05badfbb5a76082 sha
sha256:b693ea4f87d3b791603a7d0a51130aa58246fc9a913cf995f304d13a0476974a snapshot
← Older Oldest on task/push-perf-2
All commits
Newer → Latest on task/push-perf-2

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:bdd4e443023e40c96785778cad2b6947a5ec7a3fb0e628cfc05badfbb5a76082 --body "your comment"