8229407: Avoid ConcurrentHashMap resizes during bootstrap
Reviewed-by: alanb, shade, dfuchs
--- a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Mon Aug 12 11:24:53 2019 +0100
+++ b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Mon Aug 12 15:27:57 2019 +0200
@@ -183,7 +183,7 @@
this.parent = parent;
this.ucp = ucp;
- this.nameToModule = new ConcurrentHashMap<>();
+ this.nameToModule = new ConcurrentHashMap<>(32);
this.moduleToReader = new ConcurrentHashMap<>();
}
--- a/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java Mon Aug 12 11:24:53 2019 +0100
+++ b/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java Mon Aug 12 15:27:57 2019 +0200
@@ -81,7 +81,7 @@
}
// service name -> list of providers
- private final Map<String, List<ServiceProvider>> map = new ConcurrentHashMap<>();
+ private final Map<String, List<ServiceProvider>> map = new ConcurrentHashMap<>(32);
private ServicesCatalog() { }