ReviewOS

zig-utils/zig-js

Build: reduce compile, link, and test feedback time

#494
Open chris opened this 8 days ago ·
8 days ago

Parent: #459 Depends on: #462

Goal

Reduce local compile/link/test feedback time while preserving every correctness, sanitizer, corpus, and evidence gate.

Current cost

Repository guidance records a 4–6 minute test relink after src/ edits, 8–10 minute filtered probe cycles, and roughly 170 seconds for about 1,430 unit tests across ten shards. Compile-time filters still relink the large artifact.

Scope

  • Profile Zig compilation, semantic analysis, generated-table parsing, LLVM/codegen/linking where applicable, test discovery, binary size, process startup, and shard imbalance.
  • Split or reuse test artifacts by stable subsystems without duplicating production code or losing cross-subsystem/link coverage.
  • Add runtime test selection to a reusable binary where Zig permits, preserving deterministic enumeration and leak accounting.
  • Improve shard scheduling from measured per-test history and retain per-shard logs/slowest reports.
  • Reduce generated-code/table compile cost through owned generator output/layout changes, editing generators rather than generated files.
  • Keep one full combined build/link gate that catches integration/ABI drift.

No-workaround rules

  • No test deletion/skip, zero-denominator pass, reduced Debug/TSan coverage, stale binary, disabled leak checks, or external build/cache service dependency.

Acceptance

  • Reproducible baseline reports wall/CPU/RSS and phase timing for clean/incremental/focused/full/TSan builds.
  • Focused source-to-result latency and full local suite latency improve materially on the reference machine.
  • Runtime filtering selects exactly the requested tests without relink and reports a nonzero denominator.
  • Full unit, ABI, JIT/VM/concurrency, docs, corpus, and CI matrices remain unchanged in semantic coverage.
  • Build stays offline and owned under #462.

Foundation

Current test-parallel shard runner and .zig-cache/unit-shards/ logs; tools/unit_test_runner.zig already records slow tests.

8 days ago

Landed the runtime-filtering slice in f454ce61.

Evidence:

  • The reusable full-root binary discovers 1,463 tests; Fetch Body selected exactly 1 and streaming compilation selected exactly 4.
  • Changing between those filters preserved .zig-cache/o/034dd600e289e5c3fa7f8d6fd1608b8c/test, SHA-256 5f1263b86a3f68d76c52d5da0c9152bbe1c4485b92e2e978923e66b5d50d2d98, and its mtime/size.
  • The four streaming cases ran 2/1/1 across three shards; all shards reported the same 4-of-1,463 denominator, with 4 passed, 0 failed, and 0 leaked.
  • An unknown filter reported 0 of 1,463 and exited nonzero.
  • test-jit uses the same runtime mechanism; BunPress manifest verification and the 89-file docs link gate pass.

This completes the runtime-filter acceptance item. Baseline profiling, measured end-to-end latency improvements, and the remaining full semantic matrix stay open.

8 days ago

Landed two measured feedback-time slices on main:

  • test(gc): stabilize sharded concurrency coverage — keeps four concurrent realm publishers and repeated publication checks while removing redundant construction; makes the block-binding witness explicitly request and prove a real collection; fixes bounded cooperative-retry accounting in #509.
  • tools(test): rebalance measured unit-test tail — exact linked-binary discovery, strict per-test plan validation, nonzero/exact denominator enforcement, local timing history, auditable plan.tsv, and conservative tail-only placement.

Measured on the same reference checkout with 10 shards:

  • pre-change modulo baseline: 1,235.3 s wall; 1,531 passed, 1 expected platform skip, 0 failed/leaked
  • partial-history pass after the changes: 261.5 s wall; same exact 1,532 denominator and result
  • warm-history repeat: 135.7 s wall; same exact denominator and result
  • focused TSan: cooperative nursery 2/2, block binding 1/1, realm publication 1/1; 0 failures/leaks

A global-LPT prototype was rejected: it synchronized internally parallel GC tests and still had all ten shards CPU-active after 12.5 minutes. The landed policy moves at most one dominant-tail candidate per shard and preserves modulo placement for every other test; the warm plan estimated 137–153 s per shard and completed in 135.7 s.

This advances measured scheduling and full-suite latency, but #494 remains open for the clean/incremental/focused/TSan wall+CPU+RSS phase report, artifact splitting/reuse work, and complete ABI/JIT/VM/concurrency/docs/corpus matrix acceptance.

8 days ago

The reproducible phase-report acceptance item is now complete and checked.

Landed:

Evidence:

All 21 scenario commands passed without timeout. Every one of the six full-suite rows recorded 1,531 passes, one expected platform skip, zero failures/leaks, and an exact 1,532-test plan. Medians/ranges plus user/system CPU and peak RSS are retained for clean, immediate incremental, first focused relink, cached focused filter, cold/warm full unit, and focused TSan boundaries.

#494 remains open for compiler-internal phase attribution, stable artifact splitting/reuse, material controlled before/after latency evidence beyond the now-published current baseline, and the complete semantic matrix acceptance.

8 days ago

Landed tools(test): add focused frontend suite (#494).

This adds a smaller production-module frontend executable so parser/evaluator probes no longer require linking the combined inline unit-test artifact. It covers 7 accepted programs and 5 syntax/early-error rejections, supports reusable runtime filtering, and fails zero-match selections. The existing full combined suite remains the integration gate.

Validation: 12/12 frontend probes passed in Debug and TSan; a cached single-case filter passed; a zero-match filter failed as intended; the existing 4 VM and 3 concurrency probes still pass. The first TSan build/run completed in 21.91s with 1,960,361,984-byte maximum RSS. This is useful focused-path evidence, not yet the exact-parent end-to-end proof needed to check the remaining latency acceptance item, so the issue stays open.

8 days ago

Closed #525 via 2f387216: the development test262 --eval probe no longer leaks source or diagnostic rendering storage. Both success/error output contracts and the 33/33 conformance smoke pass under SafeAllocator.

8 days ago

Opened #527 after the docs accuracy gate exposed a real owner-renderer boundary: zig-js records BunPress 0.1.21, while the active ../../Tools/bunpress checkout is 0.2.0, adds search-index.json, and changes every page. The child requires renderer/source audit, deterministic safe output, deliberate manifest regeneration, and two clean reproductions; it explicitly forbids bypassing the manifest or accepting the tree wholesale.

8 days ago

Closed #527 with the owner-source fix stacksjs/bunpress@ae928ff and accepted manifest commit f98a34a2.

The audit found and fixed 18 broken indexed fragments (12 slug-normalization cases plus 6 numbered headings) without bypassing the docs gate. All 357 search destinations now resolve, two independent manifests are byte-identical, two normal docs builds pass, and BunPress passes 504 tests plus typechecking. This restores the docs portion of the semantic matrix; #494 remains open for its compiler/runtime latency and full-matrix acceptance work.

8 days ago

Compatibility follow-up #626 is complete in d46ed71e, with the required sibling fix in zig-regex@87e9ca2. This restores compilation under CI Zig dev.1811; exact-version compiler and RegExp probes plus the full local parallel unit gate pass.

8 days ago

Final #626 follow-up: 6cb02043 handles dev.1818 receiver adjustment and advances all eight automated zig-regex checkout pins. Exact dev.1818 focused tests, full local parallel units, and the dependency audit pass.

8 days ago

Related tool-feedback child #660 is complete in 8aabe412. The exact-parent self-test no longer requires the unavailable structuredClone host global, and the supported JSC-backed Home runtime now completes the full 31/31 benchmark validation gate. No production collector/schema behavior changed; flips 0 Test262 cases.

8 days ago

Child #670 now owns a versioned exact algorithmic-growth evidence profile for classifier fixes whose optimized boundary falls below stable wall/cycle/energy resolution while the exact parent grows superlinearly. It explicitly preserves the existing full-efficiency 5% policy and forbids threshold relaxation, asymmetric work, extrapolation, or throughput claims from diagnostic rows. The concrete blocker and two rejected #615 reference attempts are recorded in #670 and the #615 audit.

8 days ago

#670 exact algorithmic-growth evidence profile landed in fabf6c7c. This closes the tooling gap for classifier-growth follow-ups while preserving exact parent/candidate/dependency/binary/source/toolchain/host identities and the existing ordinary full-efficiency decision. #615 collection will resume when the local competing-process guard is clear.

8 days ago

Opened #673 for a repeatable full-suite scheduling defect: the cooperative nursery witness can report zero attempts only under eight-shard placement, then pass focused. Scope is deterministic test work/accounting with unchanged production GC thresholds and no retry-based gate.

8 days ago

Closed #673 with fec063f8: the cooperative-GC unit witness now synchronizes both tracked mutators before real Object churn, eliminating scheduler-sensitive zero-attempt inventories without retries, sleeps, lower thresholds, or weakened checks. Full units passed 1767 plus 1 skip with zero failures/leaks.

8 days ago

Integration evidence from main89fec617: CI run38180234010 completes49 checks successfully but cancels4 full unit/TSan shards. No full-green claim is made.

A single controlled rerun of TSan unit shard0 (attempt2, job114606326224) also cancels at the existing60-minute job limit. The log shows313/699 tests passed by23:57:39Z; no further test output appears until00:43:29Z cancellation. The last completed case is interpreter.test.arguments own keys list ordinary length once in creation order, which passes in4362ms. There is no next-case start marker, assertion failure, or TSan report, so the stalled test is not identified from this log.

The rerun started23:43:16Z and completed00:43:32Z; orphan cleanup terminates the test process. This is executed evidence of an unresolved full-shard stall/feedback limit, not evidence that the last completed case fails. Retained logs are available from the linked run's attempt2. Further work needs a per-case start/progress signal and stack evidence from the stalled process before changing workloads or deadlines. No larger timeout or excluded tests were used.

Sign in to comment on this issue.