mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-29 12:35:19 +00:00
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:
1 parent
c6a4fc9a8d
commit
e0ed9a86e0
14 files changed
+139
-55
No files matched your search
@@ -188,7 +188,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
/**
|
||||
* A String error message, and a boolean indicating whether it's an original error (false) or downstream from an original one (true)
|
||||
*/
|
||||
private final transient Map<String, Boolean> dependencyErrors = new HashMap<>();
|
||||
private final transient Map<String, Boolean> dependencyErrors = new HashMap<>(0);
|
||||
|
||||
/**
|
||||
* Is this plugin bundled in jenkins.war?
|
||||
@@ -256,8 +256,8 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
int idx = s.indexOf(':');
|
||||
if(idx==-1)
|
||||
throw new IllegalArgumentException("Illegal dependency specifier "+s);
|
||||
this.shortName = s.substring(0,idx);
|
||||
String version = s.substring(idx+1);
|
||||
this.shortName = Util.intern(s.substring(0,idx));
|
||||
String version = Util.intern(s.substring(idx+1));
|
||||
|
||||
boolean isOptional = false;
|
||||
String[] osgiProperties = version.split("[;]");
|
||||
@@ -300,7 +300,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
List<Dependency> dependencies, List<Dependency> optionalDependencies) {
|
||||
this.parent = parent;
|
||||
this.manifest = manifest;
|
||||
this.shortName = computeShortName(manifest, archive.getName());
|
||||
this.shortName = Util.intern(computeShortName(manifest, archive.getName()));
|
||||
this.baseResourceURL = baseResourceURL;
|
||||
this.classLoader = classLoader;
|
||||
this.disableFile = disableFile;
|
||||
|
||||
Reference in new issue
Block a user