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

StringTable::intern(Symbol*) is inefficient

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • 11
    • 9
    • hotspot

      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.

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

              Created:
              Updated:
              Resolved: