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

stringTable::intern creates redundant String when looking up existing one

    Details

    • Subcomponent:
    • Resolved In Build:
      b09

      Backports

        Description

        After JDK-8195097 in stringTable::intern the pre-insert lookup is done using a new String oop rather than the jchar* + len, which adds overhead in places like java_lang_StackTraceElement::fill_in - see https://stackoverflow.com/a/54015664/2397895

        The following naive patch speeds up microbenchmarks throwing and consuming stack traces by 1.33x on my machine:

        diff -r d3e199e30cfb src/hotspot/share/classfile/stringTable.cpp
        --- a/src/hotspot/share/classfile/stringTable.cpp Thu Jan 03 02:26:42 2019 +0100
        +++ b/src/hotspot/share/classfile/stringTable.cpp Thu Jan 03 10:29:24 2019 +0100
        @@ -334,6 +334,10 @@
           if (StringTable::_alt_hash) {
             hash = hash_string(name, len, true);
           }
        + found_string = StringTable::the_table()->do_lookup(name, len, hash);
        + if (found_string != NULL) {
        + return found_string;
        + }
           return StringTable::the_table()->do_intern(string_or_null_h, name, len,
                                                      hash, CHECK_NULL);
         }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  shade Aleksey Shipilev
                  Reporter:
                  redestad Claes Redestad
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: