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

Simplfy CoderResult cache

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 6
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      In class CoderResult there is a cache, where the cached CoderResult's are indirected via WeakReference.
      IMHO this indirection is like breaking a fly on the wheel. CoderResult is a very small object, smaller than a WeakReference itself, so why holding WeakReference objects in the cache, which there self potentially hold the CoderResult.
      I also propose to cache the CoderResult objects in an ArrayList by their length value, than in a HashMap.

      JUSTIFICATION :
      IMHO this indirection is like breaking a fly on the wheel. CoderResult is a very small object, smaller than a WeakReference itself, so why holding WeakReference objects in the cache, which there self potentially hold the CoderResult.
      Caching the CoderResult objects in an ArrayList by their length value would result in faster access, than in a HashMap. To avoid large ArrayList, there could be a reasonable threshold for caching CoderResult objects, as length > 6 should rarely occur.

            sherman Xueming Shen
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: