Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6239319

Configurable cache for valueOf method in the Short, Integer and Long classes

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P4
    • None
    • 5.0
    • core-libs
    • x86
    • windows_2000

    Description

      A DESCRIPTION OF THE REQUEST :
      This RFE requests users should be able to configure the range of cached values used by the Short.valueOf(short), Integer.valueOf(int) and Long.valueOf(long), including the ability to turn off caching. This would be achieved by the user passing a set of system properties to the JVM when it is started, e.g. :

      > java -Djava.lang.Integer.cache=-521..1024 MyApplication

      These settings should only be taken as strong hints for tuning purposes and applications should not rely on the fact that specifc values are either cached or not in order to function correctly. Thus if an application requires caching it should implement its own secondary cache. This clause would liberate future releases from the burden of supporting these settings for backward compatability.

      JUSTIFICATION :
      The current cached range of values for these methods is -128 to 127. While this standard range provides a performance enhancement for most applications, many applications also make heavy use of values outside of this range thus would benefit if they could tune the cache range to their needs. This would go hand in hand with the other currently available JVM parameters used to configure time / space tradeoffs.

      The ability to turn off caching would also allow for the setting of a baseline benchmark to compare different settings when tuning an application.
      ###@###.### 2005-03-11 08:52:23 GMT

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: