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

Caching of DecimalFormatSymbols.getInstance() not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 17
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      With benchmark:
      ---
          static char ZERO ='0';
          static java.util.Locale LOCALE = Locale.getDefault();
          @Benchmark
          public void getzero() {
              java.text.DecimalFormatSymbols dfs = java.text.DecimalFormatSymbols.getInstance(LOCALE);
              ZERO = dfs.getZeroDigit();
          }
      ---
      result:
      ---
      # Run progress: 0.00% complete, ETA 00:08:20
      # Fork: 1 of 5
      # Warmup Iteration 1: 7058414.054 ops/s
      # Warmup Iteration 2: 7305457.977 ops/s
      # Warmup Iteration 3: 7298784.527 ops/s
      # Warmup Iteration 4: 7220426.003 ops/s
      # Warmup Iteration 5: 6848879.253 ops/s
      Iteration 1: 7005216.703 ops/s
      Iteration 2: 7118703.077 ops/s
      Iteration 3: 7146410.183 ops/s
      Iteration 4: 7232477.990 ops/s
      Iteration 5: 7271271.999 ops/s
      ---

      The number of the second iteration and after should increase, as ResourceBundle is cached with the first invocation.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: