ReviewOS

home-lang/home

perf(ts): restore CommonJS graph admission after owner-transfer changes

#651
Closed chris opened this 8 days ago ·
8 days ago

Discovered while completing graph readmission under #487 and benchmark tracker #416.

The deterministic schema-3 benchmark corpus has 128 checked-JavaScript CommonJS owners plus one consumer. On current main at a572f3acd55fec4b15217d665c9433fe952a5741, a ReleaseFast home-tsc does not complete the unchanged positive project in a practical admission window:

python3 bench/vs_tsgo/run.py corpus
./zig-out/bin/home-tsc --noEmit -p bench/vs_tsgo/corpus/commonjs_graph/tsconfig.json

Observed on Apple M3 Pro/macOS: still CPU-active after 7 minutes, roughly six cores, bounded memory, no diagnostics; manually interrupted. The all-workload schema-3 preflight therefore aborts at commonjs_graph before any timing/result directory. Host load was extreme, so elapsed time is classification evidence only, not a benchmark claim. The frozen admitted #546 checkpoint completed this same 128-owner workload at 42.1 ± 0.7 ms and passed its negative controls.

Required work:

  • profile and identify the general algorithmic regression on the unchanged corpus; do not special-case benchmark names or skip checking
  • preserve the real checked module.exports union types and exact temporary negative controls (3× TS2322 + 3× TS2339)
  • retain the 198/198 CommonJS type-transfer audit and 132/132 static-require discovery audit
  • add an operation-count or focused scaling regression for the diagnosed repeated work
  • rerun complete schema-3 admission before any timing, then document the result and update the README table only with admitted evidence

No corpus, diagnostic, or sample filtering is allowed.

8 days ago

Profiled current main (a572f3acd) on the unchanged 128-owner positive CommonJS graph. A 5-second macOS sample found every worker in Program.importProgramGlobals; physical footprint reached ~7 GB within seconds. The typed-global index was treating CommonJS provider files as scripts, then relocating every provider owner into every peer compilation (quadratic owner transfer).

The in-progress fix classifies whole-property, named-property, and Object.defineProperty CommonJS exports as external modules before global publication, while preserving script semantics when module, exports, or Object are locally shadowed. This is a semantic boundary fix, not a corpus exception. Focused tests and full admission gates are being run before commit.

8 days ago

Fixed by d0b9ef0aa. The exact CommonJS positive and negative admission controls pass, the untimed type audit is 198/198, discovery is 132/132, and final schema-3 result 20260905T225537Z records Home at 31.2 ± 3.2 ms versus native TS 7 at 58.5 ± 3.7 ms (1.87x faster), with 30/30 paired wins. Documentation is staged for the final evidence commit.

8 days ago

Completed by d0b9ef0aa and documented in 4fda2da9e. CommonJS type/discovery audits pass 198/198 and 132/132; the exact workload controls pass; final result 20260905T225537Z records Home 31.2 ± 3.2 ms versus native TS 7 at 58.5 ± 3.7 ms, with 30/30 paired wins.

Sign in to comment on this issue.