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

attempt to fix performance issues with a cache #4208

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

david-driscoll
Copy link
Contributor

Description

This is an attempt to fix some of the performance problems (see #4159). As best I can tell each time that the commits are requested from a given IBranch the git library appears to enumerate again and again.

Related Issue

#4159

Motivation and Context

1.5 minutes to compute a version is a lot! 😄

How Has This Been Tested?

Best way I was able to test, was use the current version (6.0.2) and then compare to the results after caching. The difference in performance was 1 and a half minutes on my machine to 10 seconds.

Screenshots (if appropriate):

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@arturcic
Copy link
Member

@david-driscoll can you provide the logs before and after the change, with the timestamps? You can remove the sensitive information. Now if the fix works as you say, maybe it makes sense to use same caching approach in the other collections in that folder?

@arturcic arturcic self-requested a review September 13, 2024 07:18
@david-driscoll
Copy link
Contributor Author

david-driscoll commented Sep 13, 2024

So logging just halts, while it's calculating source. I found 2 gaps where it's sitting around, so it's concieveable that it's happening else where, just not as prevelent.

When I was debugging I did have 74 source branches, which isn't a lot of numbers, but when you're iterating at least 2 times, things add up. I will do a quick test, cause I still have a 10 second wait or so while it's working.

      DEBUG [24-09-13 9:24:47:66] Breaking
      INFO [24-09-13 9:24:47:66] Merge base of 'gitversion-test' and 'origin/***' is ''0a556d1' - Merge branch 'main' of REPO'
    INFO [24-09-13 9:24:47:66] -< End: Finding merge base between 'gitversion-test' and 'origin/***'. (Took: 6.46ms) >-
  INFO [24-09-13 9:24:47:66] -< End: Finding branches source of 'gitversion-test' (Took: 484.98ms) >-
  INFO [24-09-13 9:25:45:30] -< Begin: Finding branches source of 'feature/***' >-
    INFO [24-09-13 9:25:45:30] -< Begin: Finding merge base between 'feature/***' and 'origin/***'. >-
      INFO [24-09-13 9:25:45:33] Found merge base of ''b1f00f5' - Automatically linting code'
...
      DEBUG [24-09-13 9:25:46:87] Breaking
      INFO [24-09-13 9:25:46:87] Merge base of 'origin/***' and 'origin/feature/***' is ''0a556d1' - Merge branch 'main' of REPO'
    INFO [24-09-13 9:25:46:87] -< End: Finding merge base between 'origin/***' and 'origin/feature/***'. (Took: 17.02ms) >-
  INFO [24-09-13 9:25:46:87] -< End: Finding branches source of 'origin/***' (Took: 1,449.28ms) >-
  INFO [24-09-13 9:26:07:41] -< Begin: Finding branches source of 'feature/***' >-
  INFO [24-09-13 9:26:07:41] -< End: Finding branches source of 'feature/***' (Took: 6.37ms) >-

@david-driscoll
Copy link
Contributor Author

I gave it a shot, and went from 14s this morning to 12s. Honestly that's within margin of error, so I can't say it really did much.

If you want I'll be glad to push the code, it doesn't break anything that I'm aware of (unit tests are running now), however I don't have any evidence it will have any real effect.

@david-driscoll
Copy link
Contributor Author

I have discovered similar behavior with this repo as well: https://github.com/RocketSurgeonsGuild/Nuke which is public, so clone away! As long as you're on a branch other than master the calculation took 1m5s with 6.0.2 and then it was 7s with these changes.

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