Skip to content

Claude/fork precompile - #3931

Merged
squid-protocol merged 3 commits into
mainfrom
claude/fork-precompile
Sep 27, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
claude/fork-precompile

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Description

Core Engine Modification Checklist

If your PR changes the core parsing engine (language_standards.py, detector.py, prism.py), you MUST complete the following validation gauntlet before merging:

  • Golden Master Verification: Ran crucible_check.py to verify diffs, and ran crucible_check.py --update --yes if the baseline changed due to intentional parsing improvements.
  • Tri-Comparison Audit: Handled by CI automatically, but you should run python tests/tools/tri_comparison_chart.py --all --ci locally first. If you intentionally improved precision, regenerate the baseline: python tests/tools/tri_comparison_chart.py --regenerate --languages <lang>.
  • Tree-Sitter Accuracy: Ran python tests/tools/tree_sitter_accuracy_audit.py --ci --all. If ground truth drifted for valid reasons, regenerated the baseline with python tests/tools/tree_sitter_accuracy_audit.py --regenerate --lang <lang>.

Note for AI Agents: If you are an AI agent generating this PR, you MUST invoke the ci-push-checklist skill to ensure these steps are completed properly.

…guages before a fork

A/B on the crucible corpus (3 alternating rounds, A-vs-A control +-0.3%)
measured the lazy registry at +2.4% wall / +0.8% detector phase:

- _compiled_rules rescanned a language's rules on every per-segment lookup;
  each extractor now memoises the rule dicts it has compiled (non-empty ones:
  a temporary `{}`'s id can be reused).
- a forked pool's workers inherited nothing compiled, so each compiled every
  language it met; the parent now compiles the scan's active languages (the
  ones _init_worker warms, now one shared _active_languages helper) once
  before a fork. Spawned pools are left alone: their state comes from
  pickles, where a pattern travels as its source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X9PBcL8evG7CEzff1zE8v5
… wall

`wall` is the engine's own PIPELINE_SUCCESS duration, timed inside the
scan: it excludes the import. #3914 moved rule compilation from the import
(uncounted) into the scan (counted), so `wall` charged the lazy registry for
work the baseline did before its clock started. `process` times the whole
subprocess, the import included -- what a user waits for -- and is reported
beside `wall`, per round and in the means.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X9PBcL8evG7CEzff1zE8v5
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

The language lens's lexical scan runs every rule of every language that
claims an ambiguous extension (`.h`: c and objective-c). Pre-compiling only
each extension's first claimant left objective-c to every forked worker --
each compiled it (0.44 s) the first time it met a header: the
3_Language_Detector CPU rise #3929 measured on curl. On the crucible corpus a
compile trace now shows forked workers compiling 0.012 s in total (was 0.5 s),
the parent compiling the 55 active languages once.

_init_worker still warms an extractor for first claimants only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X9PBcL8evG7CEzff1zE8v5
@squid-protocol
squid-protocol merged commit 5998bd8 into main Sep 27, 2026
35 checks passed
@squid-protocol
squid-protocol deleted the claude/fork-precompile branch September 27, 2026 22:20
@squid-protocol squid-protocol added this to the Yes, but can it go faster...? milestone Sep 27, 2026 — with Claude
@squid-protocol squid-protocol added core-engine Modifications to the central physics and parsing engine performance labels Sep 27, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Outcome: this fixed large scans but made small ones slower. #3939 completes it.

This merged at 093be90a, one commit short of the branch. The last commit, the size gate, is now #3939.

Three-way phase_ab on a 4-core box, as the whole-command time (import included) against main before #3923, with an A-vs-A control:

40 C files 3,280-file crucible corpus
control +0.3% −0.4%
main with #3923 −26.2% +0.2%
this PR (ungated) −21.3% −0.7%
#3939 (gated at 500 files) −30.4% +0.0%

Why the ungated pre-compile loses on small scans:

  • A small scan's workers start on idle cores. Compiling lazily there runs in parallel and only covers what each worker meets. On data/c the workers compile c and never objective-c.
  • The parent's serial compile of every .h claimant (c and objective-c, 0.25 s) sits on the critical path instead.

What held up from this PR:

  • the per-extractor memo;
  • the every-claimant compile for large scans, which the compile trace confirms: forked workers compile 0.012 s in total, down from 0.5 s;
  • the process metric in phase_ab.

Outputs are identical throughout.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-engine Modifications to the central physics and parsing engine performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants