RFR: 8339196: Optimize BufWriterImpl#writeU1/U2/Int/Long

Shaojin Wen swen at openjdk.org
Wed Aug 28 20:05:50 UTC 2024


On Wed, 28 Aug 2024 13:16:03 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> A small optimization makes BufWriterImpl's writeU1/U2/Int/Long methods more C2-friendly and improves performance.

@liach 
Is this what you want to see?

## baseline

@ 29   jdk.internal.classfile.impl.BufWriterImpl::writeU1 (8 bytes)   inline (hot)
  @ 4   jdk.internal.classfile.impl.BufWriterImpl::writeIntBytes (54 bytes)   inline (hot)
    @ 2   jdk.internal.classfile.impl.BufWriterImpl::reserveSpace (52 bytes)   inline (hot)
      @ 45   java.util.Arrays::copyOf (33 bytes)   failed to inline: low call site frequency

@ 77   jdk.internal.classfile.impl.BufWriterImpl::writeU2 (8 bytes)   inline (hot)
  @ 4   jdk.internal.classfile.impl.BufWriterImpl::writeIntBytes (54 bytes)   inline (hot)
    @ 2   jdk.internal.classfile.impl.BufWriterImpl::reserveSpace (52 bytes)   inline (hot)
      @ 45   java.util.Arrays::copyOf (33 bytes)   failed to inline: low call site frequency


## current

@ 113   jdk.internal.classfile.impl.BufWriterImpl::writeU1 (24 bytes)   inline (hot)
  @ 2   jdk.internal.classfile.impl.BufWriterImpl::reserveSpace (22 bytes)   inline (hot)
    @ 18   jdk.internal.classfile.impl.BufWriterImpl::grow (33 bytes)   failed to inline: low call site frequency

@ 58   jdk.internal.classfile.impl.BufWriterImpl::writeU2 (38 bytes)   inline (hot)
  @ 2   jdk.internal.classfile.impl.BufWriterImpl::reserveSpace (22 bytes)   inline (hot)
    @ 18   jdk.internal.classfile.impl.BufWriterImpl::grow (33 bytes)   failed to inline: low call site frequency

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20748#issuecomment-2315596836


More information about the core-libs-dev mailing list