-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
WIP Optimize create copy of GitModule() #6373
WIP Optimize create copy of GitModule() #6373
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6373 +/- ##
==========================================
- Coverage 46.84% 46.83% -0.01%
==========================================
Files 688 688
Lines 51952 51971 +19
Branches 6836 6839 +3
==========================================
+ Hits 24335 24339 +4
- Misses 26293 26297 +4
- Partials 1324 1335 +11
|
That's actually the only instance of such use I could find through the codebase. |
I found this too in a quick search: F:\dev\gc\gitextensions_4\GitUI\UserControls\RevisionGrid\RevisionGridControl.cs(749): GitModule capturedModule = Module; There are at least 20 occurrences in constructors, that is about the same though. I find about 20 occurrences of new GitModule(path), none to create a thread local module. For the three (at least) occurrences copying the variable as well as the possibly other occurrences, the creation could be optimized (similar to what I used in the original version):
However, when I test again, I do not see the problem. Will modify the solution some. |
0b3a337
to
769c95a
Compare
Pushed an update of the Copy API, as well as avoid creating GitModules for all changed submodules. |
Submodule structure is separated from detailed status Previously, the structure was always recalculated when status was updated Also, the status is only calculated for the submodule trees where git-status has detected changes. This has simplified the code as well decreased the time before the detailed status is displayed. The status was also flashing for several seconds while updating (occurred regularly if any submodule had a change).
769c95a
to
c213a44
Compare
Rebased on #6445 (in WIP) |
Will not push this change and likely not other potential changes |
Part of #6357
Separating the second part of #6359 to not mixup discussions
https://github.com/gitextensions/gitextensions/pull/6359/files/07b797b3460c0ceef870f73cab169e9a7cafacdf#diff-a77f67d7f76305a8eeaae638ef09120a
Proposed changes
Make a copy of gitModule instead of creating a new GitModule.
This is the pattern used in similar situations, for instance GitStatusMonitor.
This avoids a call to
git rev-parse --common-dir
when querying submodules structure/status.This is not critical in itself, but it is a distraction for #6359.
Note: A previous version (in #6357) used an optimized constructor to create a new instance. This is maybe the pattern that should be used in all similar situations.
Test methodology
✒️ I contribute this code under The Developer Certificate of Origin.