Changeset - 6fb68819e58e
default
0
1
0
git: improve performance working with git changesets
GitRepository._repo instantiates a new dulwich.repo.Repo on every usage,
rather than once at initialization time of GitRepository. As this involves a
lot of filesystem access, this is a costly operation.
Instead, let GitRepository.__init__ instantiate a dulwich.repo.Repo once,
and let GitRepository._repo just return it.
This improves performance significantly.
On test_graphmod_git, performance improves from 6.29 seconds median to 3.06
seconds median.
[Thomas De Schampheleire: extend improvement to _all_ usage of
GitRepository._repo instead of only some. To limit the delta, retain the
_repo property but simply return self.repo.]
GitRepository._repo instantiates a new dulwich.repo.Repo on every usage,
rather than once at initialization time of GitRepository. As this involves a
lot of filesystem access, this is a costly operation.
Instead, let GitRepository.__init__ instantiate a dulwich.repo.Repo once,
and let GitRepository._repo just return it.
This improves performance significantly.
On test_graphmod_git, performance improves from 6.29 seconds median to 3.06
seconds median.
[Thomas De Schampheleire: extend improvement to _all_ usage of
GitRepository._repo instead of only some. To limit the delta, retain the
_repo property but simply return self.repo.]
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
0 comments (0 inline, 0 general)