ReviewOS

home-lang/home

perf(ts): stop qualified projection scans on typed receivers

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

Problem

A fresh schema-3 30-round full-suite screen of pushed main d0b9ef0aa (result 20260905T223009Z) passed all positive and negative admission controls but found a severe regression in script-heavy workloads after typed cross-file globals (#480):

  • type_predicates_large: Home 4875.7 ± 790.3 ms vs native TS 7 431.8 ± 120.8 ms (11.29x slower)
  • type_predicates: Home 96.7 ± 9.5 ms vs native TS 7 77.2 ± 3.2 ms (1.25x slower)
  • null_safe_access: Home 77.4 ± 5.6 ms vs native TS 7 67.1 ± 7.7 ms (1.15x slower)

The same run retains all 30 rounds for every compiler/workload and reports 17/20 lower Home means. One unrelated single-core fuzz process was disclosed throughout; the competitor deltas versus the September 1 checkpoint are modest, while Home large predicates regressed by ~22x, so contention does not explain the result. The repaired CommonJS row from #651 wins at 33.4 ms vs 57.0 ms.

Requirements

  • Profile the unchanged admitted large-predicate corpus and identify the general superlinear path.
  • Remove repeated whole-HIR/global-name scans without changing script/module or declaration-merge semantics.
  • Add a structural scaling/operation regression; no workload-name, identifier, diagnostic, or family-count special cases.
  • Preserve exact workload-specific rejection controls and the full global/owner/graph audit matrices.
  • Run a fresh complete schema-3 screen before updating the README performance claim.

Tracked under #416 and follows the typed-global publication work in #480.

8 days ago

Correction after profiling the exact admitted type_predicates_large project: the loss is not in Program global-provider ordering. A 3-second sample attributes ~85% of collected samples to Checker.programQualifiedIndexedAssertionDestructuredArrayType, reached through programQualifiedAssertionArrayMemberType for ordinary member reads. That recovery helper linearly scans the complete 106,496-line HIR before normal member lookup, even when the receiver already has a concrete non-any type. The feature was introduced for otherwise untransferable qualified indexed assertions (#609).

The general fix target is therefore to make projection recovery conditional on the semantic state it is designed for (an unresolved/any receiver), preserving the exact imported assertion case while ordinary typed member reads stay on the normal lookup path. I will add a shadowing/known-receiver correctness regression plus rerun the unchanged scaling screen.

8 days ago

The semantic guard is effective on the unchanged admitted corpus. A direct loaded-host check fell from 4.49 s / 82,408,298,769 retired instructions before to 0.63 s / 3,092,449,057 instructions after: 26.6x fewer instructions.

Targeted schema-3 result 20260905T225340Z retained 30 interleaved rounds after 3 warmups with verified unchanged provenance:

  • TS 6.0.3: 1412.5 ± 175.7 ms
  • native TS 7.0.2: 456.4 ± 40.8 ms
  • Home: 290.6 ± 53.1 ms
  • Home lead: 1.57x

The exact workload-specific negative controls passed before timing. Full ReleaseFast Program and checker suites pass, including the new known-receiver shadowing regression. A complete 20-workload rerun remains required after the commit is pushed.

8 days ago

Completed by e4e9d16c2 and documented in 4fda2da9e. The unchanged large-predicate corpus drops from 82.4B to 3.09B retired instructions; targeted result 20260905T225340Z restores a 1.57x lead, and final full result 20260905T225537Z records Home lower means on 20/20 workloads and 600/600 paired wins after complete schema-3 admission.

Sign in to comment on this issue.