Skip to content
Permalink
Browse files

[JENKINS-45447] Improve poll and checkout performance for repos with …

…many tags

JENKINS-45447 reports that checkout of a repository with many tags
from a freestyle job using a wildcard in the branch name is
dramatically slower than earlier releases.  Many other cases which use
the advanced branch selection mechanism show the same performance
problem.

31fedce added tag checks to the evaluation loop for branch
names. Unfortunately, tag evaluation needs both the tag name and the
SHA1 of the commit identified by the tag. The original; implementation
called revParse() to compute that SHA1 for each tag. With many tags in
the repository (bug report example was 60,000 tags), the checkout time
increased dramatically.

I found that even the number of tags in the git plugin repository
could add as much as 5 seconds for the computation of SHA1 hashes.
Those computed SHA1 hashes were then immediately discarded because
they did not satisfy the branch name selection criteria.

Calling GitClient.getTags() returns more information than
GitClient.getTagNames(), so it is possible that this change is still
not fast enough.
  • Loading branch information
MarkEWaite committed Dec 2, 2017
1 parent b95c4e8 commit 18bc3dc8ab0fa590725f09cd31443e0aee298bbf
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/main/java/hudson/plugins/git/util/GitUtils.java
@@ -9,6 +9,7 @@
import hudson.plugins.git.Branch;
import hudson.plugins.git.BranchSpec;
import hudson.plugins.git.GitException;
import hudson.plugins.git.GitObject;
import hudson.plugins.git.Revision;
import hudson.remoting.VirtualChannel;
import hudson.slaves.NodeProperty;
@@ -76,9 +77,9 @@ public static Node workspaceToNode(FilePath workspace) { // TODO https://trello.
}
r.getBranches().add(b);
}
for (String tag : git.getTagNames(null)) {
String tagRef = Constants.R_TAGS + tag;
ObjectId objectId = git.revParse(tagRef);
for (GitObject tagEntry : git.getTags()) {
String tagRef = Constants.R_TAGS + tagEntry.getName();
ObjectId objectId = tagEntry.getSHA1();
Revision r = revisions.get(objectId);
if (r == null) {
r = new Revision(objectId);

0 comments on commit 18bc3dc

Please sign in to comment.
You can’t perform that action at this time.