ReviewOS

home-lang/home

perf(ts): query CommonJS class exports from prepared modules

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

Follow-up under #416 and #487 after factory typing #534. A Debug sample of the unchanged 128-module import graph (graph-types.4EsbvV/import-sample-v3.txt) shows import queries entering moduleCommonJsExportAssignmentClassName -> compileSource -> checkPreparedSource even though the CLI already retains a prepared module. This duplicates parsing/binding/checking to answer an export-shape question, including on ES modules without CommonJS assignments.

Replace the source-compilation query with an owner-bound prepared-HIR query. Preserve supported CommonJS class-export semantics and sharing across CLI/conformance callers; eliminate text-pattern recovery rather than adding a substring shortcut. Cover ordinary assignments, comments/strings, shadowing and export reassignment as appropriate. Prove prepared owners are reused, retain all original graph correctness controls and calibrate TS6/TS7 controls before measuring. Record a reproducible same-correctness optimized baseline and interleaved after measurements, retain all outcomes and link commits/docs.

8 days ago

The verified indexed-export checkpoint is now b7b9dd9, documented and pushed in 24a34f4; frozen baseline export-index.NVcIdu/release-v3/bin/home-tsc (SHA-256 615e9fa1f78c2cad17a0b8911b897ede73c00422138d6ecbb2b74801d4564f14). All 19 unchanged admission gates and existing audits retain their scores. Source inspection confirms moduleExportImpl reads source and invokes moduleCommonJsExportAssignmentClassName for the empty-name query before obtaining the already cached moduleCompilation. The helper compiles/checks the source, scans all assignment nodes, then falls back to raw module.exports text scanning. Next change must query the prepared owner directly, remove text recovery, and cover actual root assignments, comments/strings, lexical module shadowing, and reassignment before claiming equivalent semantics or measuring. The conformance adapter has two callers requiring the same owner-bound behavior. No implementation of this follow-up is claimed yet.

8 days ago

Candidate replaces the CLI empty-name query with moduleCommonJsExportAssignmentClassNameFromCompilation on its cached bound module, eliminating the extra file read and full checking pass. The conformance adapter now retains the same prepared owner for shape/export queries. Raw source-text recovery is removed; class display names come from bound constructors/const aliases, local module bindings are distinguished, and multiple assignments do not masquerade as a single class. Program140/140 tests pass, including unchanged-owner/type-pool assertions across128 repeated queries; conformance includes cache-reuse checks for both allowJs modes. Full conformance/release admission are running. The separate CommonJS type-transfer gap is explicitly retained in #541 (Home22/66 vs both baselines66/66); no CommonJS timing is admitted.

8 days ago

Program140/140 and harness75/75 pass; CLI69/69 passes and unchanged checker/driver targets verify from cache. All19 unchanged admission gates and all15 complete audit case sets now verify, with every prior passing case still passing (verification-final.log). CommonJS remains22/66 and export-list80/96; earlier semantic gaps remain visible. The first full conformance command returned exit0 but its console log was empty after disk exhaustion, so a second full run is in progress to retain auditable output before timing. Inactive generated test/cache objects were cleaned; frozen releases and all measurement evidence remain intact.

8 days ago

Implementation1cfc33c1a is pushed as Chris, with no coauthors. Retained full conformance retry passes1418/1418 (conformance-v1-retry.log); Program140, CLI69, harness75 pass, unchanged checker/driver targets verify from cache. All19 admission gates and all15 complete audit sets preserve every prior passing case. Timing now begins after our builds/tests/audits finished: a30-round alternating before/after comparison on both unchanged graph workloads, then the complete19-workload TS6.0.3/nativeTS7.0.2 run. Candidate SHA256573257a819a178c9387f6d02a7992c08f995185f5dbc94034eb5eadc0ae956c0; baseline b7b9dd9 SHA615e9fa1f78c2cad17a0b8911b897ede73c00422138d6ecbb2b74801d4564f14. Actual compiler/runtime/launcher hashes are recorded outside timed processes (provenance-before.json; automation follow-up#544).

8 days ago

Implementation 1cfc33c (#536), audit d95dfaa (#541), and verified README/report 707045c are pushed to main as Chris with no coauthors. TS 6.0.3 and native TS 7.0.2 are verified; TS7/tsgo is one competitor.

The prepared-owner CommonJS display query removes the extra full source compilation and raw-text recovery. Program140/140, conformance1418/1418, CLI69/69 and harness75/75 pass; unchanged checker/driver targets verify from cache. All19 unchanged admission gates and all15 complete audit case sets preserve every previously passing case. Disk-interrupted logs remain alongside complete retries; no partial audit was accepted.

Same-correctness 30-round alternating comparison: import graph32.4±1.7ms to28.4±0.6ms, 12.4% less time and30/30 paired wins. Barrel27.9±5.2ms to27.3±4.2ms, only2.3% lower with17/30 paired wins: inconclusive, not a reliable improvement. All60 rounds/120 successful samples retained.

Full measurement20260828T234350Z validates570 rounds/1710 successful finite samples, with all513 input files byte-for-byte unchanged. Home has lower means on19/19: import graph28.1ms vs TS7 47.0ms (1.67x), barrel25.6ms vs42.7ms (1.67x), large predicates340.5±18.2ms vs362.2±30.4ms (1.06x;29/30 paired wins). Several rows have substantial shared-host variance. Independent confirmation20260828T234818Z retains30 rounds/90 samples: large predicates Home358.6±11.7ms vs TS7 388.5±16.7ms (1.08x;30/30 paired wins). It is separate, not substituted or pooled. Selected compiler/native-payload/runtime/launcher paths and hashes match before and after both measurements; automated harness provenance is tracked by#544.

CommonJS instance typing is NOT admitted for timing: TS6/TS7 pass66/66, Home22/66, with all44 missing wrong-type/missing-member rejections retained under#541. Export-list controls remain80/96 (#540). Other remaining gaps include owners12/20, nominal origins44/52, globals32/56 and bound globals44/56. The broader goal stays open: real projects, additional rejection coverage, other platforms and semantic correctness remain unproven. Next priorities are actual source-owned CommonJS require types#541 and precise external hidden-binding diagnostics#540.

Frozen candidate commonjs-query.hyU20d/release-v1/bin/home-tsc, SHA-256573257a819a178c9387f6d02a7992c08f995185f5dbc94034eb5eadc0ae956c0. Full results, retained history and reproduction.

Sign in to comment on this issue.