-
Notifications
You must be signed in to change notification settings - Fork 651
Caching to improve performance #1100
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
Conversation
@DanielRose: Thanks for this! If I understand this correctly, the caching you're talking about is an in-memory dictionary and has no relation to the disk-based cache stored in |
@asbjornu Yes, you are right. Note that this includes the changes of my other PR, so either that one needs to be approved as well or I would need to pull them apart. A second step would be to investigate ways of storing/invalidating this data, since the disk-based cache is currently completely bypassed when anything has changed (such as adding even a single commit). |
@DanielRose: Now that @JakeGinnivan has done the herculean effort of getting everything from GitTools.Core to GitVersion builds green again, can you please rebase this to see if it turns green as well? |
@DanielRose can you rebase this? |
I merged your first PR :) |
@JakeGinnivan @asbjornu I noticed; was in the process of rebasing. Thanks! |
Some tests are causing a stack overflow. I'll check this in more detail this evening. |
@JakeGinnivan @asbjornu Fixed it. The stack overflow was due to a possible infinite loop when having a branch inherit its configuration, but since it cannot find a parent branch, it ends up choosing itself as parent. Since the config is "inherit", it ends up finding itself again, etc. Now I issue a warning and use "Patch" instead. I also fixed the rest of the tests. In the unit tests, GitVersion runs multiple times, so I invalidate the caches at every run. |
@DanielRose: Excellent. Just to be sure, is this meant for a v4 or v3.6 target? |
@asbjornu I noticed the extreme slowness in v4 (due to the new develop version strategy), but it would also make sense on 3.6. I can cherry-pick the relevant parts for 3.6 as well, if you wish :) |
A lot of this has been re-written in v4. You would have to re-write for v3 and I don't know it's worth it. |
@DanielRose when you are online can you ping me on gitter. |
Pass on data, check that each branch is added only once.
Clear the caches for each new run of GitVersion.
…ository This makes the cache non-static and hopefully easier to maintain in the long wrong
Additional refactoring for caching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I use GitVersion on my repository (about 30k commits and 14 branches), it gets very slow. The main reason is that it calculates lots of merge bases and their commits. However, this data is ephemeral, so it gets recalculated multiple times.
Here I add two caches to improve this. The first commit caches the result of FindMergeBase(). The second caches the internal list of FindCommitBranchWasBranchedFrom().
Improvement in run times (on my machine):
This builds upon my other PR (#1085), since I use some of the refactorings I made as part of it.