Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance: cache existsSync results in PackageCache.ownerOfFile #1612

Merged

Conversation

raycohen
Copy link
Contributor

@raycohen raycohen commented Sep 26, 2023

Similar to #1608

A lot of time is being spent in PackageCache#ownerOfFile and a good chunk of that is from the calls to existsSync:

Before:
Screenshot 2023-09-25 at 11 17 06 PM

By caching, the amount of time in existsSync drops considerably in my large app, From ~12 seconds to under 500ms. The total time spent in ownerOfFile drops less, from 20 to 14 seconds.

After:
Screenshot 2023-09-25 at 11 17 18 PM

Even with the caching, this path is still so hot that there's a good deal of time in ownerOfFile and the new getCachedExistsSync methods that isn't accounted for by existsSync. There's probably more that can be done here.

@raycohen
Copy link
Contributor Author

Looks like CI is having issues downloading volta

@NullVoxPopuli
Copy link
Collaborator

fix for that is here: #1594

Copy link
Contributor

@ef4 ef4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me.

A nice-to-have in this area for someone to followup would be to refactor the existsCache and the rootCache into one thing, because I think an improved design would do both jobs. But that's not a blocker here.

@raycohen raycohen marked this pull request as ready for review September 26, 2023 18:11
@raycohen raycohen force-pushed the cache-exists-calls-in-package-cache branch from c8a5518 to 0ce95f3 Compare September 26, 2023 20:20
@ef4 ef4 merged commit f89a1c7 into embroider-build:main Sep 26, 2023
196 checks passed
@mansona mansona added the enhancement New feature or request label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants