Speed up StringBuilder::append(char[]) via Unsafe::copyMemory

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 26
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b09

      In BufferedReader.readLine and other similar scenarios, we need to use StringBuilder.append(char[]) to build the string.

      ~RogerRiggs completed the optimization when the encoder is LATIN1 in PR #24967. This PR continues to complete the optimization when the encoder is UTF16.

      For these scenarios, we can use Unsafe.copyMemory instead of the character copy of the char-by-char loop to improve the speed.

            Assignee:
            Shaojin Wen
            Reporter:
            Shaojin Wen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: