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(git): cache git exec results #1930

Merged
merged 1 commit into from
Jul 6, 2020

Conversation

mitchfriedman
Copy link
Contributor

@mitchfriedman mitchfriedman commented Jul 6, 2020

Cache results of the git exec calls.

Pretty anecdotal/not-profile-driven perf improvements, but intuitively it makes sense anyways.

For example, on a project i'm working on I get over 200 of:

Calling git with args 'rev-parse --show-toplevel'

with > 700 git commands executing

before:

❯ time gfs validate
garden validate 42.44s user 63.68s system 237% cpu 44.720 total

after:

❯ time gfs validate                   
garden validate  40.08s user 52.55s system 279% cpu 33.179 total

What this PR does / why we need it:

Faster commands :)

@@ -81,10 +82,16 @@ export class GitHandler extends VcsHandler {
}

async getRepoRoot(log: LogEntry, path: string) {
if (this.repoRoot) {
return this.repoRoot
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be cached based on the path value, because there may be multiple repo roots, e.g. with remote sources, submodules etc

@edvald edvald merged commit 5dce835 into garden-io:master Jul 6, 2020
@mitchfriedman mitchfriedman deleted the cache-git-results branch July 6, 2020 17:14
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