Commit a2f553e
perf(ci): persist V8 compile cache across test jobs (#6009)
## What
Enable Node's on-disk **V8 compile cache** (`NODE_COMPILE_CACHE`) for
the three test jobs (`test`, `test-egg-bin`, `test-egg-scripts`) and
persist it with `actions/cache`:
- Job-level `env.NODE_COMPILE_CACHE: ${{ runner.temp
}}/node-compile-cache` so the value is inherited by vitest workers and
any forked child processes, not just the top-level process.
- A `Cache Node compile cache` step (pinned `actions/cache@0057852…` #
v4, the same pin already used for the utoo store) keyed
`node-compile-cache-${{ runner.os }}-node${{ matrix.node }}-${{
hashFiles('pnpm-workspace.yaml', '**/package.json') }}` with graduated
`restore-keys`, so the cache survives **within** a run (shared across
processes) and **across** runs.
`typecheck` is intentionally excluded — it runs `tsgo`/`oxlint`/`tsdown`
(Rust), not Node module execution, so there is nothing for the V8
compile cache to help.
Safety: Node validates each cache entry by source hash + Node version,
so a stale restored entry is simply ignored (cache miss → recompile +
rewrite). The change is low-risk and fully reversible.
## Honest measurement (please validate on CI before marking ready)
Opened as **draft** because the local benefit I could measure is ~0 and
the CI/Windows benefit is unverified:
- On **macOS/arm64**, an A/B/C micro-benchmark of the egg-bin fork
bootstrap (a full `egg-bin test` run, which populates **1346 cache files
/ 7.7 MB**) showed **no measurable speedup** — warm-cache runs landed
inside the no-cache noise band (20.3–22.4s), and were marginally
*slower* due to `flushCompileCache` write overhead on exit.
- Reason: per-fork wall time is dominated by the **oxc transform** and
**module import** (`transform 1.51s` + `import 1.56s` of a 2.9s run),
plus process spawn — and the compile cache only caches the **V8
compilation of already-transpiled JS**, not the transform itself.
- The case for keeping it rests on the **CI runners being much slower**
at exactly the V8-compile + file-read work the cache removes (x64
ubuntu, and especially Windows) than an M-series Mac. That is plausible
but **unmeasured here**. On Windows there is even a downside risk: a
cache hit adds an extra file read per module (source + cache blob), and
every file open is scanned by Defender, so it could be neutral or
negative.
**How to validate:** compare the test-job step durations run-over-run
(the existing `Report parallelism metrics` job already surfaces CI
timing), and/or check cache hit-rate in the Actions cache UI. Keep if it
helps a platform; drop the env+step if not.
## Scope note
This does **not** touch `tools/egg-bin/test/coffee.ts`, which forks the
egg-bin CLI ~109× with a freshly-built `env` that does not pass
`NODE_COMPILE_CACHE` through — so the compile cache does not currently
reach those forks. That (and the Windows `test-egg-bin` slowdown
generally) is being investigated separately on a Windows machine and is
out of scope for this PR.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Improved CI build and test performance by enabling a Node.js
compile-cache mechanism for relevant test jobs.
* **Tests**
* Ensured compile-cache tests run with a clean environment by resetting
related cache settings before each test.
* Made the subscription interval/cron test more reliable in CI by
increasing the wait time before log-based assertions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9080894 commit a2f553e
3 files changed
Lines changed: 57 additions & 1 deletion
File tree
- .github/workflows
- packages/core/test/loader
- plugins/schedule/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
184 | 199 | | |
185 | 200 | | |
186 | 201 | | |
| |||
260 | 275 | | |
261 | 276 | | |
262 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
263 | 293 | | |
264 | 294 | | |
265 | 295 | | |
| |||
326 | 356 | | |
327 | 357 | | |
328 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
329 | 374 | | |
330 | 375 | | |
331 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
754 | 763 | | |
755 | 764 | | |
756 | 765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
0 commit comments