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

Initial size of UnicodeBlock map is incorrect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 12
    • None
    • core-libs
    • None
    • b24
    • generic
    • generic

    Description

      The initial load size for UnicodeBlock.map is currently 649 as follows:

      ---
          public static final class UnicodeBlock extends Subset {
              /**
               * 649 - the expected number of entities
               * 0.75 - the default load factor of HashMap
               */
              private static Map<String, UnicodeBlock> map =
                      new HashMap<>((int)(649 / 0.75f + 1.0f));
      ---

      However, actually it is 667 in the latest 12 build. The discrepancy comes from incorrect upgrading of Unicode version, which did not count for extra aliases.
      Although this does not affect the actual performance (HashMap aligns initial capacity to a power of 2 size (= 1024 in both cases), this fix is desired for correctness.

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              naoto Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: