Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6230

Use the JVM's cache of Number instances in ReuseFactory

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.11.1.1
    • Fix Version/s: 10.11.1.1
    • Component/s: Services
    • Labels:
      None
    • Bug behavior facts:
      Performance

      Description

      ReuseFactory has a cache of Byte, Short, Integer and Long instances to avoid excessive allocation of such instances.

      As of Java 5, the JVM has a cache of its own, available through static valueOf() methods in these classes.

      The JVM's cache is guaranteed to have at least all values in the range [-128, 127]. ReuseFactory currently caches Integer instances in the range [-1, 18] plus a few special values, and Byte, Short and Long instances in the range [0, 10].

      If we change ReuseFactory so that it uses the JVM's cache, the number of cache misses will be lower, and the code will become shorter.

        Attachments

        1. derby-6230-01-a.diff
          3 kB
          Knut Anders Hatlen

          Activity

            People

            • Assignee:
              knutanders Knut Anders Hatlen
              Reporter:
              knutanders Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: