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

StringTable::intern(Symbol*) is inefficient

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 9
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:

      Description

      StringTable::intern is a go-to way to convert Symbol* to String oop, see e.g. JDK-8151751. However, it is not very efficient, because it goes through multiple conversions: Symbol* (UTF-8) ---> jchar* (UTF-16?) --> lookup --> java.lang.String (UTF-16/Latin1).

      See e.g. the profile for a proof-of-concept patch from JDK-8151751, StringTable::intern dominates there, and the hottest codepaths inside are UTF8::unicode_length and UTF8::convert_to_unicode that produce jchar* for table lookup.

      http://cr.openjdk.java.net/~shade/8153849/StringTable-intern.txt
      http://cr.openjdk.java.net/~shade/8153849/Symbol-as-unicode.txt

      Making a table to lookup with a Symbol* key would benefit this.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gziemski Gerard Ziemski
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: