-
Sub-task
-
Resolution: Fixed
-
P4
-
None
-
b132
Various code constructs in java.lang.invoke pull in an excessive amount of classes early during bootstrap. Some non-intrusive refactorings can reduce the number of classes we depend on and load early.
Examples:
- Using an EnumMap<Wrapper, MethodHandle> in sun.misc.invoke.ValueConversions pulls in 5 EnumMap-related classes. Additionally calling values() on an enum class to get the number of enum creates and loads an array class and cause a clone to be allocated every time, which is detrimental to startup performance.
- Using result.addAll(Arrays.asList(buf).subList(0, bufCount)) rather than a simple for-loop pulls in 5 classes
Examples:
- Using an EnumMap<Wrapper, MethodHandle> in sun.misc.invoke.ValueConversions pulls in 5 EnumMap-related classes. Additionally calling values() on an enum class to get the number of enum creates and loads an array class and cause a clone to be allocated every time, which is detrimental to startup performance.
- Using result.addAll(Arrays.asList(buf).subList(0, bufCount)) rather than a simple for-loop pulls in 5 classes