summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain <sylvain.desodt@gmail.com>2023-09-10 23:35:01 +0200
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-09-11 12:28:25 +0000
commite9cb3911178669cb16a65ab5741eea44b79fea03 (patch)
tree6eadf67578bf25bac113b0cb17145cd775a828de
parent25d6c7cc108bea4c81e124623bcf7f4b6832a914 (diff)
downloadgit-repo-e9cb3911178669cb16a65ab5741eea44b79fea03.tar.gz
project: Optimise GetCommitRevisionId when revisionId is set
When comparing 2 manifests, most of the time is spent getting the relevant commit id as it relies on _allrefs which ends up loading all git references. However, the value from `revisionIs` (when it is valid) could be used directly leading to a huge performance improvement (from 180+ seconds to less than 0.01 sec which is more than 25000 times faster for manifests with 700+ projects). Bug: 295282548 Change-Id: I5881aa4b2326cc17bbb4ee91d23293111f76ad7e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385834 Tested-by: Sylvain Desodt <sylvain.desodt@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Sylvain Desodt <sylvain.desodt@gmail.com>
-rw-r--r--project.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/project.py b/project.py
index 34e9046d..f2f81d7a 100644
--- a/project.py
+++ b/project.py
@@ -1443,6 +1443,8 @@ class Project(object):
1443 rather than the id of the current git object (for example, a tag) 1443 rather than the id of the current git object (for example, a tag)
1444 1444
1445 """ 1445 """
1446 if self.revisionId:
1447 return self.revisionId
1446 if not self.revisionExpr.startswith(R_TAGS): 1448 if not self.revisionExpr.startswith(R_TAGS):
1447 return self.GetRevisionId(self._allrefs) 1449 return self.GetRevisionId(self._allrefs)
1448 1450