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

Walkdir caching first pass #4587

Merged
merged 10 commits into from
Mar 14, 2025
Merged

Walkdir caching first pass #4587

merged 10 commits into from
Mar 14, 2025

Conversation

RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Mar 11, 2025

Description

Cache listDir results and ignore file rectified ignores for directories

  • for 30 seconds OR
  • till invalidated

Any file changes, creations, deletions, or index requests will invalidate the cache, so the only effect this has for now is that parallel walk dirs will be much more efficient. It will not speedup e.g. walkdir for a single instance of codebase reindexing.

Ways to improve:

  • More precise invalidation logic and/or longer cache time
  • this approach does not make the walk dir significantly faster, it just makes way more processor-efficient. Parallel walkDir calls still wait for the promises of previous ones. This might be preferable to a shorter but more severe spike. I tried some approaches to saving cache hits for later and snagging the next

Case study: Startup in react repo

Before:
image

After:
image

CPU Load:
image

Copy link

netlify bot commented Mar 11, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 14db334
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67d4756d156c6f0008a1b664

for (const ig of ignoreContexts) {
if (shouldIgnore) {
continue;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is another improvement - if one ignore comes out as true, skip the rest.

@sestinj sestinj merged commit deb3c36 into main Mar 14, 2025
31 checks passed
@sestinj sestinj deleted the dallin/cache-walkdir branch March 14, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants