Skip to content

perf: opt ada and yacc state_mutation into _line_gates (Part of #3171) - #5439

Merged
squid-protocol merged 3 commits into
mainfrom
churn/3171-20261018T0838Z
Oct 18, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
churn/3171-20261018T0838Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3171 (first slice: the 9 languages eligible today). Opts ada and yacc state_mutation into _line_gates; the other seven were benched and stay ungated.

Bench (line_gate_bench.py-style, best of 3-15, LANGUAGE_CRUCIBLE corpus)

lang corpus dense (all lines survive) verdict
ada 1.12x faster (50 files) 1.40x faster ship
yacc 2.5x faster (2 files) 0.80x (loss 23%, bound 35%) ship
lua 1.1x 0.71-0.75x (loss 33-41%) refused, borderline fail
zig 1.07x 0.63-0.67x refused
haskell, m4, makefile, scheme, tcl 0.56-0.82x (lose on corpus) 0.54-0.76x refused

Exact parity (spans) held on every corpus for all nine. The win is small, as the issue predicted.

Gates

  • line_gate_bench.py all pass; gate_parity_audit.py zero violations.
  • test_line_gates.py + test_rule_prefilter.py: 71 pass (pinned literal sets, parity tests, declared-count premise now >= 5).
  • crucible_check.py (check mode, both legs): PASS, zero golden diff, no bless. A gate cannot change counts.
  • audit_check.py: all clear.

Remaining slices / Sibling gaps

  • ts/java narrowing: pattern_is_line_local refuses java at alternation branch 3 and typescript at branches 3 and 4 ("class matches newline"; likely a negated class lacking \n). Needs zero-movement proof and golden both legs. Then js, python, rust and ~30 more refused languages.
  • lua is borderline on the dense bound: could be revisited with a cheaper literal pick.
  • 9 line-local languages with no derivable literal (agc_assembly, assembly, dockerfile, easytrieve, fortran, hlasm, jcl, powershell, rexx) need rule redesign.
  • B_Braces/func_start line gating belongs under perf: cut Optical Detector regex cost (COBOL Cartography is 76s CPU / 55% of extraction) #3182.
  • No burned-estate program needs any of these gaps.

Lessons for agents

  • line_gate_bench.py only covers rules already declared in _line_gates; to bench a candidate, time line_gated_finditer vs finditer from a scratch script.
  • The selfscan venv's ruff 0.16 wants ruff format changes in test_line_gates.py that audit_check.py does not flag; don't reformat that file wholesale.

🤖 Generated with Claude Code

line_gate_bench.py: ada corpus 1.1x / dense 1.4x faster; yacc corpus 2.5x / dense 0.8x
(within the 35% bound). haskell, lua, m4, makefile, scheme, tcl and zig lost on corpus
or dense and stay ungated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 18, 2026 08:48
@squid-protocol
squid-protocol enabled auto-merge (squash) October 18, 2026 08:52
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol added the shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md label Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5439 @ 6939cbb: 2 failed check(s)

== full-suite (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39112887014/job/117637131686
repro: python -m pytest -q tests
errors:
##[error]Process completed with exit code 1.
log tail:
Hosted Compute Agent
Version: 20261012.601
Commit: f3dc54e1fb89da6852db922499a0233137369e1d
Build Date: 2026-10-12T17:48:21Z
Worker ID: {79fcfc89-cadd-4e0b-bde3-06dddef9ea2c}
Region: eastus2
Cloud: Azure
##[endgroup]
##[group]Operating System
Ubuntu
24.04.5
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20261012.334.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20261012.334/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20261012.334
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: full-suite
##[group]Run echo "full-suite parts: $PARTS (tested-tree skip: $SKIP)"
echo "full-suite parts: $PARTS (tested-tree skip: $SKIP)"
# #4935: "skipped" is a pass only when the gate proved this tree green on the PR; otherwise it is a failure
test "$PARTS" = "success" || { test "$PARTS" = "skipped" && test "$SKIP" = "true"; }
shell: /usr/bin/bash -e {0}
env:
PARTS: failure
SKIP:
##[endgroup]
full-suite parts: failure (tested-tree skip: )
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== full-suite part 2/3 (failure) -- main
https://github.com/squid-protocol/gitgalaxy/actions/runs/39112887014/job/117634709707
repro: fails on main too: fix main (then merge origin/main here)
failing tests: tests/extraction/languages/test_ada_strict.py::test_ada_schema_completeness
errors:
fail-on-cache-miss: false
E AssertionError: ada rules dict has unexpected keys not in the baseline schema: {'_line_gates'}
tests/extraction/languages/test_ada_strict.py:135: AssertionError
FAILED tests/extraction/languages/test_ada_strict.py::test_ada_schema_completeness - AssertionError: ada rules dict has unexpected keys not in the baseline schema: {'_line_gates'}
##[error]Process completed with exit code 1.
log tail:
env:
PYTHONUTF8: 1
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
OMP_NUM_THREADS: 1
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
PYTEST_ADDOPTS: --ignore=tests/cobol_mainframe
##[endgroup]
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: test-times-part-2.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 172461
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 4b170ac24b7f462b1c929c7bb9d3eab3d04453c3a82eb4efd35aad992228751b
Finalizing artifact upload
Artifact test-times-part-2 successfully finalized. Artifact ID 12131752283
Artifact test-times-part-2 has been successfully uploaded! Final size is 172461 bytes. Artifact ID is 12131752283
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/39112887014/artifacts/12131752283
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/33adb37e-d263-45c2-860e-f751c74c0897' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-protocol squid-protocol added shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 18, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md labels Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

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

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant