Repository navigation
Commit 6ab6559
perf(runtime): deduplicate concurrent client manifest loads (#528)
## Issue
`createManifestLoader()` caches the client manifest after fetching and
parsing it. Concurrent HTML renders on a fresh instance can all miss
that cache and load separate copies.
This duplicates work during overlapping cold loads. Warm requests
already reuse the cached manifest.
## Fix
Share one pending promise across concurrent manifest loads. Cache
successful results and clear the pending promise when it settles,
allowing missing manifests and failed loads to be retried.
## Verification
Added unit coverage for concurrent loads sharing one fetch and manifest
object, completed-cache reuse, and retries after a missing response or
rejected fetch.
- `vp test run packages/void/test/unit/routing-runtime.test.ts`: 40
tests passed on Node 24.21.0.
Benchmarked eight simultaneous cold SSR requests using real generated
manifests, with no artificial asset delay. Median burst completion times
across nine shuffled runs on Node 24.21.0:
| Generated pages | Before | After | Manifest reads/parses |
|---|---:|---:|---:|
| 1,000 | 28.52 ms | 21.27 ms | 8 → 1 |
| 10,000 | 120.55 ms | 49.43 ms | 8 → 1 |
Single-request controls performed one load on both revisions; warm
bursts performed zero additional loads. HTML output matched, and browser
hydration and navigation checks passed.
These results describe concurrent cold bursts. Production frequency and
full SSG build impact have not been measured.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 957026d commit 6ab6559
2 files changed
Lines changed: 52 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
808 | 844 | | |
809 | 845 | | |
810 | 846 | | |
| |||
0 commit comments