🤖 perf: Use tsgo for main process compilation (19.6x faster) #264
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
tscwithtsgofor main process compilation, achieving a 19.6x speedup (3.489s → 0.178s). Completes investigation of tsgo integration opportunities across the entire build toolchain.Performance Impact
Main process build:
Type checking (already optimized in PR #260):
Full build:
Regression Risk⚠️
Medium risk - Changing the compiler from tsc to tsgo for production builds:
@typescript/native-previewis pre-release software (v7.0.0-dev)tsc-aliaspost-processing (tsgo doesn't resolve@/imports)Mitigation:
Rollback plan: If issues arise, revert to
tscby changing one line in Makefile (line 77).Changes
Makefilebuild-main target: Uses tsgo directly, no fallback branchesMakefiletypecheck target: Removed tsc fallback (already had branch from PR 🤖 feat: Replace tsc with tsgo for 7.7x faster type checking #260)Investigation Findings
Analyzed every component of the build toolchain to maximize tsgo usage:
Key findings:
@/imports, sotsc-aliasstill required (~0.7s overhead, acceptable)Conclusion: We've maximized tsgo usage. The remaining build time (~21s Vite renderer compilation) cannot be optimized with tsgo due to architectural constraints.
Build Reproducibility
Removed all conditional branches (if/else fallbacks) from build targets. Builds now fail fast with clear errors if dependencies are missing, rather than silently using different compilers.
Added to Makefile header:
Testing
make buildmake typecheck@/imports in compiled outputmake devGenerated with
cmux