Package jenkins.util
Class MemoryReductionUtil
java.lang.Object
jenkins.util.MemoryReductionUtil
Utilities to reduce memory footprint
- Author:
- Sam Van Oort
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String[]
Empty string array, exactly what it says on the tin. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map
getPresizedMutableMap
(int elementCount) Returns a mutable HashMap presized to hold the given number of elements without needing to resize.static String[]
internInPlace
(String[] input) Returns the input strings, but with all values interned.static int
preallocatedHashmapCapacity
(int elementsToHold) Returns the capacity we need to allocate for a HashMap so it will hold all elements without needing to resize.
-
Field Details
-
EMPTY_STRING_ARRAY
Empty string array, exactly what it says on the tin. Avoids repeatedly created empty array when calling "toArray."
-
-
Constructor Details
-
MemoryReductionUtil
public MemoryReductionUtil()
-
-
Method Details
-
preallocatedHashmapCapacity
public static int preallocatedHashmapCapacity(int elementsToHold) Returns the capacity we need to allocate for a HashMap so it will hold all elements without needing to resize. -
getPresizedMutableMap
Returns a mutable HashMap presized to hold the given number of elements without needing to resize. -
internInPlace
Returns the input strings, but with all values interned.
-