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

API: Speed up Locale.equals() check.

XMLWordPrintable



      Name: bb33257 Date: 12/04/97


      Locale.equals is called in many places. It can be sped up in
      the following ways:

      1. use String.intern on all of the fields of the Locale in
      all construction. Then equals becomes:
              if (language != other.language) return false;
      ... instead of using equals.

      2. Then speed up performance-sensitive comparisons like in
      String.toUpperCase:
              if (locale.getLanguage().equals("tr")) {
      by adding API:
       boolean isChildOf(Locale other)
      which can utilize == on the fields of locale.

      3. Introduce Locale.intern (following the same mechanism as
      String.intern). Make all of the constants such as Locale.CANADA, plus
      Locale.getDefault use the intern mechanism. This will make
      common equality comparisons faster.


      ======================================================================

      I've filed item #1 above as a separate bug, #4112433, because unlike #2
      and #3 it does not require an API change and can be implemented in a
      dot dot release.

      laura.werner@eng 1998-02-13

            joconnersunw John Oconner (Inactive)
            bcbeck Brian Beck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: