Repository navigation
Reuse immutable graph views across rule checks - #108
Draft
TristanKruse wants to merge 1 commit into
Draft
TristanKruse wants to merge 1 commit into
TristanKruse wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Closes #101. Builds on merged #107; targets
maindirectly. No public fluent API or analysis-mode changes, no release/publication.clear_cache, global clearing, changed ignore/exclusion settings and CLI command resets get new views. In-flight rules may finish on their original immutable snapshot. The bundle cannot keep itself alive through a caller-held raw graph after cache clearing.Regression evidence
Performance methodology / tradeoff
Extend
benchmark/study's existing fixture/oracle/measurement helpers, not a second benchmark framework. Fresh paired baseline/candidate processes use identical harness files; the baseline is merged #100 (e2d347e14e0f8d06489582bcb7c5473295a7df4b) to avoid attributing source-walker gains to this PR.Measure graph-only, one rule, twenty identical rules and twenty genuinely different rules (7 file / 7 layer / 6 slice), with separate forbidden/empty controls. Report cold graph, a separate cold-plus-whole-suite, individual warm checks, allocation counts, post-GC retained Ruby heap and Linux lifetime peak RSS. Manual read-only pinned CI runs three alternating pairs per workload on Linux/Windows at 10,000 sources. Ordinary tests use four fixture pairs and no machine-speed gates.
Retained views add O(V+E) memory when requested (fixed three slots per existing cached analysis, not per rule); slices intentionally remain uncached because frozen Procs can still capture mutable state. Do not claim uniform gains for all policy types or a memory reduction.
Compatibility/quality/package, locked dependency security, the RAG fixture (36 examples), all four pinned real-world canaries, strict documentation validation (204 pages), all twelve installed-gem acceptance scripts and the original research/semantic study pass. The 10,000-source paired study is run 45446554405; Windows measurements are still in progress.
Linux three-trial medians (seconds), 10,000 sources:
Post-GC retained Ruby heap growth is ~6.66 → 9.83 MiB for indexed suites (about 3.17 MiB extra); graph-only growth differs by only a few hundred bytes. Peak RSS is not uniformly better: the repeated-suite median rises 139,448 → 154,672 KiB, while varied-suite medians are 150,124 → 148,852 KiB. Cold single-rule timing is ~1.3% higher in this Linux sample. These are shared-runner observations, not hard thresholds or claims of universal speed/memory improvements.