Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor BufWriterImpl improvements #5

Open
wants to merge 3 commits into
base: JDK-8294960-invoke
Choose a base branch
from

Conversation

cl4es
Copy link

@cl4es cl4es commented May 3, 2024

-10k bytecode executed on startup

Profiling some of the microbenchmarks shows writeIntBytes is often one of the hottest methods, eg. AdHocAdapt.transform:

Method                                                                                                  Samples Percent
------------------------------------------------------------------------------------------------------- ------- -------
jdk.internal.classfile.impl.BufWriterImpl.writeIntBytes(int, long)                                           28   6,51%
jdk.internal.classfile.impl.ClassReaderImpl.<init>(byte[], ClassFileImpl)                                    19   4,42%
jdk.internal.classfile.impl.AbstractInstruction$BoundInstruction.<init>(Opcode, int, CodeImpl, int)          18   4,19%
jdk.internal.util.ArraysSupport.vectorizedMismatch(Object, long, Object, long, int, int)                     16   3,72%
jdk.internal.classfile.impl.SplitConstantPool.map()                                                          14   3,26%

With this patch it drops off the list and the specialized writeU2 etc shows up, but only further down the list:

Method                                                                                                  Samples Percent
------------------------------------------------------------------------------------------------------- ------- -------
jdk.internal.classfile.impl.CodeImpl.forEachElement(Consumer)                                                24   5,83%
jdk.internal.classfile.impl.ClassReaderImpl.<init>(byte[], ClassFileImpl)                                    22   5,34%
jdk.internal.classfile.impl.AbstractInstruction$BoundInstruction.<init>(Opcode, int, CodeImpl, int)          17   4,13%
jdk.internal.util.ArraysSupport.vectorizedMismatch(Object, long, Object, long, int, int)                     17   4,13%
jdk.internal.classfile.impl.ClassReaderImpl.utf8EntryByIndex(int)                                            13   3,16%
jdk.internal.util.ArraysSupport.unsignedHashCode(int, byte[], int, int)                                      12   2,91%
jdk.internal.classfile.impl.BufWriterImpl.reserveSpace(int)                                                  12   2,91%
jdk.internal.classfile.impl.BufWriterImpl.writeU2(int)                                                       11   2,67%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant