Repository navigation
#3929: pre-compile before a fork only for scans of 500+ files (small scans keep #3923's 30% win) - #3939
Merged
Conversation
Three-way A/B (pre-#3914 / main / fix, A-vs-A control, whole-command time): pre-compiling every claimant in the parent took the 3,280-file crucible corpus to -0.7% (main +0.2%), but made a 40-file C scan slower than main (-21% vs -26% against pre-#3914): its 3 workers start on idle cores, where compiling lazily -- in parallel, only what each meets (never objective-c there) -- beats one serial compile. Large scans keep every core busy to the end, where a worker's own compile is wall time (#3929: curl -0.47 s). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X9PBcL8evG7CEzff1zE8v5
Contributor
This was referenced Sep 27, 2026
Merged
assert_redos_immune spawns a child and allows it timeout_sec (1 s) from start(). Since #3923 a registry rule is a LazyPattern, which unpickles through gitgalaxy's language registry: the child imported 74 gitgalaxy modules (258 ms here, more on a loaded runner) inside that window and a linear rule read as hung (macOS 3.9 on #3939: agc_assembly func_start). _plain() compiles the rule in the parent; a plain pattern unpickles through `re` alone (0.6 ms, no gitgalaxy import). _best_of_timing compiles before its clock too. A disabled rule (None) passes through as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X9PBcL8evG7CEzff1zE8v5
Owner
Author
|
macOS 3.9 failure:
Generated by Claude Code |
3 tasks
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 #3929. This is the last commit of the #3929 work. #3931 was squash-merged at
093be90a, one commit before this one.#3931 made the parent process compile, before forking the pool, the rules of every language that claims one of the scan's extensions. That fixed the regression on large scans. But the same A/B showed it losing #3923's gain on small scans.
A small scan's workers start on idle cores. There, compiling lazily wins:
One serial compile of every claimant in the parent is slower. Large scans keep every core busy to the end, so there a worker's own compile adds to wall time and compiling once in the parent wins.
This PR gates the pre-fork compile on
total_files >= 500(_PRECOMPILE_MIN_FILES). It is a 10-line change togalaxyscope.py.Measured
tests/tools/phase_ab.pyon a 4-core Linux box: alternating rounds, an A-vs-A control, andGITGALAXY_LICENSE_KEYset.The
processcolumn is the whole command, the import included. #3931 added it becausewall(PIPELINE_SUCCESS) starts after the import. #3923 moved about 2 s of rule compilation out of the import and into the scan, sowallcharges that work to #3923 while the baseline's same work sits before its clock starts.40 C files (
language-crucible/data/c, 5 rounds), all relative to pre-#3923 main:3,280 files (
language-crucible/data, all 66 languages, 3 rounds):audit.json,sarif.json) is IDENTICAL for every engine and both targets.Type of change
The change affects scheduling only, not output. Rules compile at a different moment, which cannot change what they match, and the artifact-identity check above confirms it.
CI checklist
audit_check.pytests/core_engine/test_lazy_re.pyandtest_inline_extraction.pyDifferential Scan target
n/a
Verification
A compile trace shows where compilation lands:
c(about 0.16 s, in parallel) and neverobjective-c.🤖 Generated with Claude Code
https://claude.ai/code/session_01X9PBcL8evG7CEzff1zE8v5
Generated by Claude Code