mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
perf(compiler): yield in dev for a module's own imports only
In dev every resolution of an analysis waited for a macrotask, so a pending server-fn request gets in between an update's resolutions as it did while each was resolver I/O (+3.4 ms per server-fn edit without it; one yield per compile did not restore it). A compile that follows a barrel's `export *` chain resolves hundreds of specifiers of other modules and paid one turn each (~909 per route module of a 2-level, 50-module barrel), ~1 µs of scheduling apiece. Only the module's own imports yield now. Every module of the compiler-perf apps yields exactly as before (all their yields were own imports, the server-fn probe module's one included), so the server-fn HMR latency is unchanged; the barrel route modules yield 12 times instead of 909: dev compile -23 % sequential, -29 % with all modules at once (in-process, paired, identical outputs). Builds never yield. Test: pipeline.test.ts "gives pending macrotasks a turn per own import in dev, not per re-export it follows" (22 turns before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6021617f4a
commit
bcc0c2361b
2 changed files with 55 additions and 5 deletions
Loading…
Add table
Add a link
Reference in a new issue