8000 perf: performance envelope at 100K–10M facts (#394) by adityamukho · Pull Request #533 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf: performance envelope at 100K–10M facts (#394) - #533

Merged
adityamukho merged 2 commits into
v3from
perf/394-envelope
Oct 11, 2026
Merged

adityamukho merged 2 commits into
v3from
perf/394-envelope

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Closes #394 (closing keywords don't fire on v3; close it by hand after merge).

What

  • examples/perf_envelope.rs builds and caches fixtures of 100K, 1M and 10M facts: six attributes per entity, a :manager ref tree, two valid-time windows, and an entity with 1,000 versions. It measures open and checkpoint time, RSS, and p50/p99 for twelve query shapes. The build, the storage measurements and each shape run in their own process, so each peak RSS is that step's alone. A shape is abandoned after --cap-secs, and a query error (such as INT-020) is recorded as the shape's result.
  • New [profile.envelope]: release at opt-level 3, which is how an application's release build compiles the library. release and bench (which inherits it) are opt-level "z" and run these queries about 1.5× slower. That also applies to the existing Criterion numbers; this PR leaves them unchanged.
  • docs/BENCHMARKS.md gets a performance envelope section: what is supported, what is not, the full tables, the fixture, the profile breakdown and the Python FFI round trip. The README's stale v5-era performance table is replaced with a summary.
  • .github/workflows/envelope.yml runs 100K and 1M on workflow_dispatch, and a 10K smoke pass on PRs that change the harness.
  • The nightly Criterion query/* groups gain 100k and 1m scales.
  • CONTRIBUTING release checklist: re-run the envelope for each minor release. Also CHANGELOG, ROADMAP, CLAUDE.md, and the design spec docs/superpowers/specs/2026-10-11-perf-envelope-design.md.

Headline results (opt-level 3, i7-1065G7, SSD)

100K 1M 10M
Point lookup p50 / p99 13 / 16 µs 12 / 48 µs 12 / 46 µs
Open, RSS after open 0.12 ms, 3 MiB 0.14 ms, 3 MiB 0.12 ms, 3 MiB
Checkpoint after 1 fact p50 3.1 ms 2.9 ms 3.8 ms
Attribute scan p50 43 ms 0.46 s 4.8 s
Selective 2-clause join p50 54 ms 0.61 s 6.5 s
Rule query (6-row ancestor walk) 2.7 s fails INT-020 > 60 s

Follow-ups filed from profiling at 1M facts

The Python side is a separate PR to minigraf-python v3 (bench/envelope.py).

Testing

  • cargo fmt --check, cargo clippy -- -D warnings, cargo bench --no-run and cargo build --examples are clean. The pre-push hook ran the test suite.
  • Ran the full envelope locally at all three scales, and again after the profile change; the published numbers are from the opt-level 3 run.

🤖 Generated with Claude Code

https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h

adityamukho and others added 2 commits October 11, 2026 00:54
examples/perf_envelope.rs builds and caches fixtures of N facts (six
attributes per entity, a ref tree, two valid-time windows, a hot entity
with 1,000 versions) and reports open and checkpoint times, RSS, and
p50/p99 latency for twelve query shapes. The build, the storage
measurements and each shape run in their own child process, so each peak
RSS is that step's alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
The harness now runs each query shape in its own process (open costs
~0.1 ms) so each peak RSS is that shape's alone, abandons a shape after
--cap-secs, and reports a query error such as INT-020 as the shape's
result. It builds with a new envelope profile: release is opt-level z
for the REPL binary's size and runs these queries ~1.5x slower than an
application's opt-level 3 build.

docs/BENCHMARKS.md and the README publish the envelope: point lookups
and single-entity time travel stay at 12-14 us up to 10M facts; scans,
aggregations and joins grow with the attributes they touch; rule
queries are supported to 100K facts. A Python FFI round trip adds
~70 us per query. Profiling at 1M facts filed #528-#532.

envelope.yml runs 100K and 1M on demand and a 10K smoke pass on PRs
that change the harness. The nightly query/* Criterion groups gain
100k and 1m scales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
@codecov
codecov Bot commented Oct 11, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 42b88ba into v3 Oct 11, 2026
25 checks passed
@adityamukho
adityamukho deleted the perf/394-envelope branch October 11, 2026 02:57
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.

1 participant

0