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

Use the JVM's cache of Number instances in ReuseFactory

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.11.1.1
    • 10.11.1.1
    • Services
    • None
    • 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

            knutanders Knut Anders Hatlen
            knutanders Knut Anders Hatlen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: