Micro-optimizations to Plugin data to reduce minimum memory for Jenkins (#3654)

* Reduce memory footprint for the plugin info by presizing hashmaps to reduce waste for small maps and interning commonly duplicated plugin strings

* Replace duplicated empty string arrays with the one in MemoryReductionUtil

* Fix interning where strings are null

* Fix to deal with the fact that we directly mutate dependency fields for UpdateSite, sigh

* Reduce starting HashMap size for some hashmaps likely to be empty or tiny

* Cleanup per review comments

* Trim some extra waste out of the UpdateSite warnings

* Fix count of optional dependencies

* Move predicates for dependency matching to top-level static final field so they are not duplicated
This commit is contained in:
Sam Van Oort authored and Oleg Nenashev committed 2018-10-06 12:49:07 +02:00
1 parent c6a4fc9a8d
commit e0ed9a86e0
14 files changed
+139 -55

No files matched your search

+2 -2
View File
@@ -26,6 +26,7 @@ package hudson;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.TaskListener;
import jenkins.util.MemoryReductionUtil;
import hudson.util.QuotedStringTokenizer;
import hudson.util.VariableResolver;
import jenkins.util.SystemProperties;
@@ -92,7 +93,6 @@ import javax.annotation.Nullable;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
/**
@@ -1388,7 +1388,7 @@ public class Util {
@Nonnull String symlinkPath, @Nonnull TaskListener listener) throws InterruptedException {
try {
Path path = fileToPath(new File(baseDir, symlinkPath));
Path target = Paths.get(targetPath, new String[0]);
Path target = Paths.get(targetPath, MemoryReductionUtil.EMPTY_STRING_ARRAY);
final int maxNumberOfTries = 4;
final int timeInMillis = 100;