Skip to content

Pop-A part (a): light module-decl scan in MODULE_INDEX OnceLock (~90s/run win) - #5454

Merged
briansrls merged 5 commits into
mainfrom
session/warm-ram-537-pop-a
Jun 21, 2026
Merged

briansrls merged 5 commits into
mainfrom
session/warm-ram-537-pop-a

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The test-helper MODULE_INDEX OnceLock (in src/v1/tests/src/helpers.rs) called parse_source() — full tokenize+parse — on every .dag file under dsl/ and src/v1/ to extract module names for the import-resolution index. With ~428 .dag files this paid a significant parse cost once per test process, manifesting as ~90s of overhead on every rust-gate run (proud-deer #5447 measurement).

Fix: Replace extract_module_declaration's full parse with a line scan — skip blank///-comment lines, then strip module <name> from the first substantive line. No tokenize or parse needed; the module declaration grammar is a simple prefix. Same None semantics for files without a declaration.

Test plan

  • scan_dag_files_last_wins_on_duplicate_module_names_without_panic — ok
  • build_module_index_co_root_last_wins_on_duplicate_module_names — ok
  • resolver_imports_ephemeral_generated_source_root — ok
  • Pre-existing CI failures confirmed as main-inherited (not this change)

🤖 Generated with Claude Code

…/run win)

The test-helper MODULE_INDEX OnceLock called parse_source() (full tokenize+parse)
on every .dag file under dsl/+src/v1 to extract module names. With ~428 .dag files
this paid a significant parse cost once per test-process, showing up as ~90s on
every rust-gate run regardless of which tests run.

Fix: replace extract_module_declaration's full parse with a line scan —
skip blank/comment lines, then strip "module <name>" from the first
substantive line. No full tokenize or parse needed; the module declaration
grammar is trivially scannable. Falls back to None (same as before) on files
with no module declaration.

All three module-index unit tests pass (scan_dag_files_last_wins,
build_module_index_co_root_last_wins, resolver_imports_ephemeral).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@briansrls
briansrls force-pushed the session/warm-ram-537-pop-a branch from 71b6830 to 6319dac Compare June 21, 2026 07:16
@gunbai-bot gunbai-bot Bot changed the title Pop-B build-once fix (§1 floor cost): the ~16 already-#[ignore]'d subprocess/network tests are mostly (a)/(b) defects — ~6 rebuild the SAME stage0 binary per test instead of consuming the floor's prebuilt release bin. FIX: route them through the already-built binary (build-once / consume prebuilt re Pop-A part (a): light module-decl scan in MODULE_INDEX OnceLock (~90s/run win) Jun 21, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 21, 2026 07:17
briansrls and others added 4 commits June 21, 2026 07:19
…faithfully

Add a one-line doc note explaining that the .dag grammar uses only // line
comments (no block comments or attributes), so the light scan's skip rule is
a faithful subset of the full header convention — not an approximation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ackages only

The freshness check in ci_spec.dag scanned all of `$ROOT/src` for `.rs` files
newer than `claim_executor`/`gunbc`. This fires as a false positive when only
`src/v1/tests/` (v1-compiler-tests) changes — that package is not in the binary
dep graph, so cargo correctly skips the rebuild, but a cached binary's mtime
precedes the freshly-checked-out test helper's mtime.

Fix: enumerate the three actual source packages (`stage0`, `stage0_core`,
`stage0_emit_core`) instead of scanning the whole `src/` tree. Regenerated
ci.yml via `main_wet` on dsl/tools/ci_yaml_gate.dag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant