RFR: 8242452: During module definition, move conversion of packages from native to VM
Claes Redestad
claes.redestad at oracle.com
Mon Apr 13 19:22:19 UTC 2020
Hi,
during JDK 9 development we ended up converting package name Strings
from external to internal form in the JNI layer rather than in Java - a
reasonable optimization at the time[1].
In light of recent startup optimization work, profiles now show clearly
that we still have some overhead here. Partly due calling many times
over into the VM from JNI. Moving the conversion completely into VM we
reduce overhead of Module.defineModule0, with a measurable effect
on bootstrap overhead[2].
Patch: http://cr.openjdk.java.net/~redestad/8242452/open.00/
Bug: https://bugs.openjdk.java.net/browse/JDK-8242452
Testing: tier1-6, complete headless run of JCK 15-b04 locally
The patch includes a few enhancement to internal utilities, e.g., an
as_utf8_string variant which allows (re-)using a provided char buffer if
it's sufficiently sized, but which does not truncate the converted
string if the buffer is too small. I'm open to splitting that out into a
standalone RFE if preferable.
Thanks!
/Claes
[1] https://bugs.openjdk.java.net/browse/JDK-8171855
[2]
perf stat -r 250 java HelloWorld
Before:
103,884,846 instructions # 0.81 insns per cycle ( +- 0.07% )
20,470,109 branches # 419.732 M/sec ( +- 0.07% )
740,708 branch-misses # 3.62% of all branches ( +- 0.14% )
0.033977482 seconds time elapsed ( +- 0.23% )
After:
102,459,412 instructions # 0.80 insns per cycle ( +- 0.08% )
20,192,923 branches # 416.229 M/sec ( +- 0.08% )
733,137 branch-misses # 3.63% of all branches ( +- 0.13% )
0.033858386 seconds time elapsed ( +- 0.32% )
More information about the jigsaw-dev
mailing list