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

perf(vcs): cache the hashes of untracked files when possible #5920

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vvagaytsev
Copy link
Collaborator

@vvagaytsev vvagaytsev commented Apr 10, 2024

Now Garden scans all the untracked files twice:

  • While looking for Garden config files
  • While actions/modules resolution

For big projects with a large amount of untracked files that can cause performance downgrade.

For non-persistent commands and commands that are running outside the fev console it seems to be possible to cache the hashes of the untracked files.

Fixes #5844

@vvagaytsev
Copy link
Collaborator Author

It's an optimization to save time on scanning projects with a large amount of untracked files. Let's double-check if this approach is reliable and there are not uncovered corner-cases left.

It should be ok to cache files in non-persistent commands and in the commands that are running outside the dev console. Is there anything related to Cloud that hasn't been taken into account in the PR?

cc @eysi09 @thsig @edvald

core/src/vcs/git.ts Outdated Show resolved Hide resolved
@vvagaytsev vvagaytsev force-pushed the perf/cache-hashes-of-untracked-files branch from e2f3785 to e2bca15 Compare April 11, 2024 09:44
@vvagaytsev vvagaytsev marked this pull request as ready for review April 15, 2024 08:23
@vvagaytsev vvagaytsev requested review from edvald and removed request for eysi09 and thsig April 15, 2024 08:23
@edvald
Copy link
Collaborator

edvald commented Apr 15, 2024

My first instinct is that this could fail in some unforeseen manner, but I'm not sure if I can think of a concrete failure mode. I wonder if we shouldn't use the TreeCache helper for this? That's what we use for other types of caching that may need to be invalidated across command runs in the same process.

I'd also consider making this opt-in via environment variable, at least while we're proving this out.

@vvagaytsev vvagaytsev force-pushed the perf/cache-hashes-of-untracked-files branch from e2bca15 to dd45fc5 Compare April 17, 2024 12:32
@vvagaytsev vvagaytsev marked this pull request as draft May 7, 2024 13:27
@vvagaytsev vvagaytsev force-pushed the perf/cache-hashes-of-untracked-files branch from dd45fc5 to ea44c2e Compare May 7, 2024 13:41
Now Garden scans all the untracked files twice:
* While looking for Garden config files
* While actions/modules resolution

For big projects with a large amount of untracked files that can cause performance downgrade.

For non-persistent commands and commands that are running outside the fev console
it seems to be possible to cache the hashes of the untracked files.
@vvagaytsev vvagaytsev force-pushed the perf/cache-hashes-of-untracked-files branch from ea44c2e to 46114a5 Compare May 20, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve project init performance
2 participants