chore: significant speedup by skipping filing-cabinet ts-config parsing #237
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.
madge
is annoyingly slow for us. This patch takes it from1m26s
to7s
(>10x speedup), for ~2,000 typescript files.filing-cabinet
, which the dependency walking stuff runs internally, runs this incredibly slow config loader in the loop. Instead, do it at the top, and pass the object in, which it already supports.Config loading mostly copied from: https://github.com/dependents/node-filing-cabinet/blob/74185e06edbbcbb3062265946adbada9b5584999/index.js#L199-L201
This is essentially just doing
JSON.parse(fs.loadFileSync(..))
, aiui. except it copes with some typescript weirdness (e.g. comments in the json).I'm not sure that's really the best place to translate the config object, but the
program.tsConfig
above seems not to be hit? I don't really understand why.