perf: speed up config loading - #123
Merged
Merged
Conversation
Skip a redundant deep clone when merging JSON config, and only strip JSON comments when a plain parse fails.
Bump nanoid to v6 and vitest to v5, raise dayjs and lodash minimums, and drop the poolOptions config vitest has ignored since v4.
The test harness reported child exit before stdout was fully read, so the test sometimes missed the final log line and timed out. Wait for the child's close event and check the full output instead of individual chunks.
Cherry
marked this pull request as ready for review
October 1, 2026 14:32
mja00
approved these changes
Oct 1, 2026
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.
Speeds up config loading at startup without changing behaviour, brings dependencies up to date, and fixes a flaky test.
loadConfigno longer runs_.cloneDeepbefore_.mergeon JSON config files._.mergealready copies plain objects and arrays, so the clone did nothing.JSON.parsefirst and only strips comments if that fails. Most config files containing//are just URLs, not comments.random()already guards against the sizes that now throw.poolOptionsblock from the vitest config, which vitest has ignored since v4.exit, which can fire before its output has been fully read. It now waits forclose, and the test checks the full output instead of individual chunks.Results
setup()time, excluding autoload, median of 15 runs on three production app configs:Testing
//and/*inside JSON strings, config not sharing objects with cached JSON, andcode()withnullor frozen data.