Package jenkins.util

Class MemoryReductionUtil

java.lang.Object
jenkins.util.MemoryReductionUtil

public class MemoryReductionUtil extends Object
Utilities to reduce memory footprint
Author:
Sam Van Oort
  • Field Details

    • EMPTY_STRING_ARRAY

      public static final String[] 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

      public static Map getPresizedMutableMap(int elementCount)
      Returns a mutable HashMap presized to hold the given number of elements without needing to resize.
    • internInPlace

      public static String[] internInPlace(String[] input)
      Returns the input strings, but with all values interned.