8000 perf: avoid per-EAV allocations in net assertion by adityamukho · Pull Request #236 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf: avoid per-EAV allocations in net assertion - #236

Merged
adityamukho merged 8 commits into
mainfrom
fix/issue-227-net-asserted-perf
May 14, 2026
Merged

adityamukho merged 8 commits into
mainfrom
fix/issue-227-net-asserted-perf

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Benchmark regression - 2026-05-03 #227
  • Replaces the per-EAV Vec<Fact> grouping in net_asserted_facts with flat maps for max retraction tx and valid-time windows.
  • Preserves same-EAV multi-window bitemporal semantics while avoiding per-group allocation overhead on large mostly-unique fact sets.

Verification

  • cargo test --test bitemporal_test same_eav -- --nocapture
  • cargo test --test bitemporal_test retraction_cancels -- --nocapture
  • cargo bench --bench minigraf_bench -- "^concurrent_btree_scan/100k"
    • 100k_2t: 130.39 ms
    • 100k_4t: 182.85 ms
    • 100k_8t: 403.63 ms, noisy but below the original post-regression local median of 425.27 ms
  • cargo test
  • Pre-push hook: cargo fmt --check, cargo clippy, cargo test

@codecov
codecov Bot commented May 13, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

adityamukho and others added 5 commits May 14, 2026 08:47
Two unit tests directly exercising net_asserted_facts:
- multiple retractions of the same EAV (max_retract_tx must be the
  global maximum across all retractions, not the first seen)
- retraction wipes all valid-time windows for the same EAV triple

Also expands the function doc comment with an implementation note
documenting the two-map single-pass approach and the known memory
tradeoff for high-retraction workloads (by_window holds all assertions
before the filter_map runs), as called out in the PR review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adityamukho
adityamukho merged commit cdc91e4 into main May 14, 2026
36 checks passed
@adityamukho
adityamukho deleted the fix/issue-227-net-asserted-perf branch May 14, 2026 03:35
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.

Benchmark regression - 2026-05-03

1 participant

0