Repository navigation
perf(forgebook): scan a first start's dependencies quickly, carefully on failure - #213
Merged
Merged
Conversation
… on failure Since the scan reads past scripts that do not parse, it read and parsed every component of the project in JavaScript, then the scanner parsed it again: on Aksel that was a fifth of the first start's pre-bundling. The pre-bundling now scans quickly first, reading only the story files itself, and scans again carefully only when a script stops the quick scan, so a project with a broken file still gets every package and the warning naming the file.
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.
What and why
Cold start and
sidebarReadygrew on every real system since 4f80455 (bench Mac: Aksel +13% cold, +30% sidebar; Fluent +29% sidebar; Salt +15% cold). On Aksel, locally:That points at the first start's pre-bundling, which the server waits for. Timing
forgebook prebundlealone shows it: 0.3.2 0.85–0.89 s, develop 1.24–1.29 s.The cause is #177. To keep the scan going past a script that does not parse, the scan's load hook now reads and parses every project script in JavaScript (
parseSync), and then the scanner parses it again. This pull request keeps that behaviour and only changes when it runs:optimizeDepsthrows "Failed to scan for dependencies"), a careful scan runs, as today. It reads past the file, pre-bundles every package, and names the file. A failure naming unresolved imports is retried as before in each mode.Numbers (Aksel at the corpus's commit, back to back, shared Mac at load 15–20)
forgebook prebundle, wallThe cold-start row is noisy: the checks were running at the same time. It was measured together with the pattern-check fix, which is a separate pull request.
How it was verified
test/dependencyScan.test.ts: a quick scan over a broken component throws, and the careful scan then pre-bundles what the broken file imports..jsstory with JSX, broken components) pass unchanged.pnpm checksexit 0.Not in this pull request
🤖 Generated with Claude Code