perf: Improve performance by caching the isUsingTranspiler function#680
Open
igeligel wants to merge 1 commit intoamilajack:mainfrom
Open
perf: Improve performance by caching the isUsingTranspiler function#680igeligel wants to merge 1 commit intoamilajack:mainfrom
isUsingTranspiler function#680igeligel wants to merge 1 commit intoamilajack:mainfrom
Conversation
Cache the isUsingTranspiler per directory
isUsingTranspiler functionisUsingTranspiler function
Owner
|
thanks for this, happy to merge after fixing merge conflicts |
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 this PR is doing?
We are memoizing the
isUsingTranspiler. File reads are not great in large mono repositories. Where I work this is a bottleneck. Specifically for directories with a large number of files this can blow up the time a lot.This PR also fixes a minor bug. The function took the
contextand computed the directory likeconst dir = context.filename ?? context.getFilename();.The problem is that this is passing the file name instead of the expected directory to
findUp. This is also fixed in this PR. I have added tests as well.Benchmarks
Gist: https://gist.github.com/igeligel/af1961949a79d91e4855fc017b1d75ef