Skip to content

perf(checker): accelerate Go package loading - #472

Merged
akonwi merged 5 commits into
mainfrom
autoresearch/go-package-loading/01-accelerate-go-package-loading
Aug 26, 2026
Merged

perf(checker): accelerate Go package loading#472
akonwi merged 5 commits into
mainfrom
autoresearch/go-package-loading/01-accelerate-go-package-loading

Conversation

@akonwi

@akonwi akonwi commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • add passive ARD_PIPELINE_PROFILE=1 timing for the complete Ard test pipeline
  • preserve Go export caching by replacing dependency go.mod overlays with readonly, content-addressed modfiles
  • load root export metadata through a narrow go list query and decode it into one shared go/types universe, with package-driver and source-loading fallbacks
  • reduce duplicate export work through dependency-aware ordering and cap implicit cmd/go parallelism without overriding explicit user settings

Performance

Balanced medians from three complete runs per project on the current branch:

Project Baseline Final
Migrate 794.933ms 83.731ms
Tinear 379.010ms 80.871ms
Maestro server 756.852ms 102.257ms
Aggregate 1930.795ms 266.859ms

That is an 86.2% reduction (7.2× faster) in frontend.load_go_packages.

Holdout projects also improved substantially during the optimization: Decode 169→49ms, SQL 720→118ms, Dram 310→88ms, and KB 632→106ms.

Correctness safeguards

  • retains build tags, cgo files, root and dependency diagnostics, physical local-FFI boundaries, and context cancellation
  • preserves explicit and implicit GOPACKAGESDRIVER behavior
  • falls back to full source loading when export data is missing or incompatible
  • retries incomplete readonly module metadata with private writable files, without mutating project, dependency, or shared-cache inputs
  • keeps all roots in one shared Go type universe and adds cross-root named-type identity coverage
  • uses atomic private-cache writes with Windows recovery and temporary-file fallback
  • does not inject -p, leaving explicit GOFLAGS and persisted GOENV parallelism to cmd/go

Validation

  • cd compiler && go test ./...
  • cd compiler && go test -race ./checker
  • gopls check checker/go_packages_resolver.go checker/go_import_internal_test.go
  • complete Migrate, Tinear, and Maestro test suites on every measured candidate
  • repeated holdout suites across four additional Ard projects
  • finalization tree verification and commit-message validation

Profile Ard's real test pipeline and reduce Go package-loading latency without weakening the shared Go type universe or package diagnostics. Replace overlay-invalidated source loading with readonly content-addressed modfiles, decode compiler exports in one shared universe, use a narrow direct go list adapter with compatibility fallbacks, tune subprocess/action parallelism, and decode roots in dependency-aware order.

Experiments: #1, #2, #5, #7, #12-16, #18, #21-26, #29, #35-37
Metric: package_load_ms 1930.795ms -> 257.680ms (-86.7%, 7.5x faster)
Validation: complete Migrate, Tinear, and Maestro suites; full compiler tests; checker race tests; gopls; holdout projects; code review.
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ard-lang-dev Ready Ready Preview Aug 25, 2026 9:34pm

@akonwi
akonwi merged commit 93f4880 into main Aug 26, 2026
6 checks passed
@akonwi
akonwi deleted the autoresearch/go-package-loading/01-accelerate-go-package-loading branch August 26, 2026 02:04
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