Package jenkins.util
Class MemoryReductionUtil
java.lang.Object
jenkins.util.MemoryReductionUtil
Utilities to reduce memory footprint
- Author:
- Sam Van Oort
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final String[]Empty string array, exactly what it says on the tin.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic MapgetPresizedMutableMap(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 intpreallocatedHashmapCapacity(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_ARRAYEmpty string array, exactly what it says on the tin. Avoids repeatedly created empty array when calling "toArray."
 
- 
- 
Constructor Details- 
MemoryReductionUtilpublic MemoryReductionUtil()
 
- 
- 
Method Details- 
preallocatedHashmapCapacitypublic 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.
- 
getPresizedMutableMapReturns a mutable HashMap presized to hold the given number of elements without needing to resize.
- 
internInPlaceReturns the input strings, but with all values interned.
 
-