Repository navigation
perf(dev): compile with the project's tsc without npx - #38
Merged
Merged
Conversation
5 tasks done
Upd4ting
added a commit
that referenced
this pull request
Nov 11, 2026
…ild's (#39) ## Why A module created from this template should spend as little time as possible on install, build, test, start and reload (ANT-1957, the second wave of the org-wide perf pass). `typecheck` (`tsc --noEmit`) and the compiles of `pnpm build` and `pnpm test` (`tsc --skipLibCheck`) shared one incremental state file, `dist/.tsbuildinfo`. Each run overwrote it with different options. A `typecheck` that ran after a test or a build found the `--skipLibCheck` state, so it checked every declaration file again. That happens on every `pnpm run checks` after the first and on every pre-push hook after a test. ## Summary `typecheck` now keeps its own state file with `--tsBuildInfoFile node_modules/.cache/typecheck/.tsbuildinfo`, next to the `tsconfig.config.json` cache already in `node_modules/.cache`. It checks the same program with the same options, so the diagnostics stay the same. A cached error still fails the next run. `tsc` itself invalidates the file from file hashes and options. `pnpm build` and `pnpm test` keep `dist/.tsbuildinfo`. `antelopejs-sync --check` accepts the script. Readability cost: one flag on the `typecheck` script. ## Workload and numbers The numbers come from a module created with `ajs module init --template "Module Typescript" --pm pnpm` through `antelopejs-verify`, then `pnpm install --frozen-lockfile`, from current main. Node 24.22.2, pnpm 10.6.5, on a shared 16-core server. | Command | Before | After | Runs per side | | --- | --- | --- | --- | | `pnpm run checks`, repeated, before and after alternating | median 3246 ms (3146 to 4016) | median 2528 ms (2286 to 3339) | 8 | | `pnpm typecheck` right after `pnpm test` | mean 1486 ms (1413 to 1571) | mean 592 ms (571 to 636) | 8 | A second interleaved run of `checks` on a module that already had the `npx` fix (#38) gave the same picture: median 3032 ms (2912 to 3480) before, 2209 ms (2143 to 2486) after. The first `typecheck` on a fresh clone still pays the full check, about 1.46 s, as before. Evidence level: confirmed through end-to-end benchmarks. Impact: Medium. It saves about 0.7 to 0.9 s on each `pnpm run checks` after the first, a 22 to 27% cut, and about 0.9 s on each pre-push hook that follows a test or a build. Correctness check: with `export const bad: number = "x";` appended to `src/index.ts`, two `pnpm typecheck` runs in a row both fail with `TS2322`, and the run after the fix passes. ## Related issue ANT-1957. `@antelopejs/tooling-configs` writes `typecheck: "tsc --noEmit"` as its default script, so other templates that also build with `--skipLibCheck` likely pay the same cost. That belongs in tooling-configs, not here. ## Verification - `pnpm run checks`: `Checks: 12 passed, 0 failed.` - `antelopejs-verify journey <run> --plan`: every journey passes, `tooling/scaffold-lint-rejects` (an unused local still fails `typecheck`) and `tooling/scaffold-checks` included. ## Checklist - [x] The pull request title follows Conventional Commits. - [x] I added or updated tests when behavior changed. Behavior does not change. `scaffold-lint-rejects` and `scaffold-checks` cover it. - [x] I updated documentation when users or contributors are affected. No document names the `typecheck` command line. - [x] I documented breaking changes and migration steps. There are none. - [x] I did not include credentials or unrelated changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
A module created from this template should spend as little time as possible on install, build, test, start and reload (ANT-1957, the second wave of the org-wide perf pass). It ran
tscthroughnpxin four places.npxadds about 200 ms of npm startup to every call.Summary
The test config and the playground config now call the project's own compiler as
node node_modules/typescript/bin/tsc:antelope.test.ts: theinstallCommandthatpnpm testruns.playground/antelope.config.ts:installCommandandreloadCommandfor the playground and for the module.pnpm devruns both at start and the module's on each reload.It is the same
typescriptpackage with the same arguments and the same incrementaldist/.tsbuildinfo. The output and the diagnostics stay the same. Only the npm startup is gone. The command does not depend onPATH, so it also works with a globalajs. This is the same change as AntelopeJS/template-blank-typescript#36.Readability cost: the command names a path inside
node_modulesinstead ofnpx tsc.Workload and numbers
The numbers come from a module created with
ajs module init --template "Module Typescript" --pm pnpmthroughantelopejs-verify, thenpnpm install --frozen-lockfile. Node 24.22.2, pnpm 10.6.5, on a shared 16-core server. Before and after runs alternate, anddistis warm, as in a developer's loop.npx tsc)pnpm testpnpm devstart, untilHello worldpnpm devreload, from the edit until the module is rebuiltStart runs two compiles, so it saves about twice what one call saves. Evidence level: confirmed through end-to-end benchmarks. Impact: Low. It saves about 175 ms on each
pnpm testand each CI run, about 290 ms on eachpnpm devstart and about 130 ms on each reload.npx tscalone took 686 ms andnode node_modules/typescript/bin/tsctook 477 ms (hyperfine, 8 runs each, warmdist).Related issue
ANT-1957.
Verification
pnpm run checks:Checks: 12 passed, 0 failed.pnpm build && pnpm --dir playground buildpasses.antelopejs-verify journey <run> --plan:PASS smoke/module-build,PASS playground/playground-dev,PASS tests/module-test,PASS tests/module-test-fails.Checklist
module-test,module-test-failsandplayground-devcover it.AGENTS.mdsays the test config compiles withtsc, which stays true.