perf(resource): reduce EIP search CPU by 93%#306
Open
Savid wants to merge 1 commit into
Open
Conversation
Contributor
🐼 Smoke eval —
|
| question | result | tokens | tools |
|---|---|---|---|
forky_node_coverage |
✅ | 14,938 | 5 |
tracoor_node_coverage |
✅ | 16,591 | 6 |
mainnet_block_arrival_p50 |
✅ | 16,156 | 8 |
list_datasources |
✅ | 13,025 | 2 |
block_count_24h |
✅ | 16,599 | 9 |
missed_slots_24h |
✅ | 20,045 | 16 |
chartkit_default_arrival_distribution |
✅ | 36,197 | 12 |
storage_upload_session_scoped |
✅ | 22,432 | 22 |
🔭 Langfuse traces (8 runs; ⚠️ = failed)
The report walks this branch's commits against the master baseline and the most recent release. A self-contained copy is in the run's eval-smoke-* artifact.
samcm
approved these changes
Jul 16, 2026
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.
Summary
Optimize the per-query hot path in
EIPIndex.Searchwhile preserving the same ranked EIPs and scores.The cold, held-out confirmation improved
ns_per_opfrom 1,184,777 to 78,539 ± 463: approximately 93.37% less CPU time / 15.1× throughput for the measured search workload.What changed
NewEIPIndexinstead of lowercasing the corpus for every query.strings.Contains, so Bloom collisions cannot change results.float64once at index construction and convert each query vector once per search.eipbyte scan.There is no public API or wire-format change.
Benchmark result
The benchmark times only
EIPIndex.Searchover freshly seeded, all-distinct queries. The baseline used three runs after a discarded warmup and measured 1,184,777 ns/op at approximately ±0.28% jitter. Optimization rounds used five interleaved candidate/incumbent pairs on the same VM, with a fresh seed per round.The final artifact was then cold-booted and measured with held-out seed 1020, which was never used for selection:
Best-so-far progression
Per-round paired evidence
Correctness and anti-gaming controls
The experiment's frozen oracle checked:
1e-6;The promoted source initially matched the cold-confirmed snapshot byte-for-byte. The only post-promotion cleanup was deleting the now-unused predecessor
filterMayContainhelper after the precomputed-probe implementation replaced every call; this has no runtime behavior.Evidence caveats
The final artifact did reproduce cold, so the end-to-end result is the number to trust. However, the experiment's accepted-gain ledger did not reconcile: it over-counted gains by 134,661 ns because round 8 compared against a stale pre-round-7 incumbent backup and re-banked most of the round-7 Bloom-filter gain. Consequently, this PR does not claim that the individual round gains add up; it claims only the independently confirmed baseline-to-final result.
Round 20's removal of the presence slice was retained as a simplicity tiebreak. Its isolated paired gain,
352.8 ± 198.8 ns, did not clear the configured556.6 nsacceptance threshold. The aggregate artifact containing that change nevertheless passed the held-out cold confirmation and correctness oracle.Tradeoffs
float64chunk vectors, increasing resident memory in exchange for substantially lower per-query CPU.Validation
go test ./...go test -race ./pkg/resource/...golangci-lint run ./pkg/resource/...All pass locally.