Review Request: VCS: Speedup the check for non-existant git-repositories

Fabian Wiesel fabian.wiesel at googlemail.com
Tue Apr 7 17:00:25 UTC 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/532/
-----------------------------------------------------------

(Updated 2009-04-07 10:00:25.003091)


Review request for KDevelop.


Changes
-------

There was some "magic" involved. Git caches the last repository-root in the environment and checks, whether a directory is a subdirectory of the last one.
Implementing the same behaviour leads  to the following result for a git-repository (Directory depth 200):

                  With patch   without patch
First call        40ms         20ms
Subsequent calls  20ms         15ms

No guarantees on accuracy. The numbers might be a bit skewed in favour of "Without patch", as the test run was done after the "with patch".

The benchmark for non-git repositories should be largely unaffected. 

Also added same caching logic to the mercurial-plugin.

So it seems like a trade-off of up to 20ms overhead for a very deeply nested git-controlled directory (but only 1ms for a low directory depth) against up to 40ms savings for fairly flat non-git repositories.


Summary
-------

In the case that a directory is not under the control of git, a check whether a directory is under version control accounts roughly 40ms of a total 70ms (Peak ~200ms) in the creation of a context menu.
By first checking for the existence of a .git directory in all parent directories, one avoids the call to an external program.  Should a correctly named directory be found, the external program is still called, which does a more sophisticated check.

In my limited "benchmark", the additional calling costs seem to be up to 1ms.


Diffs (updated)
-----

  /trunk/KDE/kdevplatform/plugins/git/gitplugin.h 950727 
  /trunk/KDE/kdevplatform/plugins/git/gitplugin.cpp 950727 
  /trunk/KDE/kdevplatform/plugins/mercurial/mercurialplugin.h 950727 
  /trunk/KDE/kdevplatform/plugins/mercurial/mercurialplugin.cpp 950727 

Diff: http://reviewboard.kde.org/r/532/diff


Testing
-------


Thanks,

Fabian





More information about the KDevelop-devel mailing list