RFR: 8320924: Improve heap dump performance by optimizing archived object checks
Aleksey Shipilev
shade at openjdk.org
Tue Nov 28 20:45:36 UTC 2023
Profiling heap dumping code reveals another simple issue: `mask_dormant_archived_object` on dumping hotpath takes quite a bit of time. We can reflow it for better inlineability, throwing out the non-essential parts into cold method. There is also no reason to peek into java mirror with (default) keep-alive, if we only use the result for null-check.
Example improvements on Mac M1:
% for I in `seq 1 5`; do build/macosx-aarch64-server-release/images/jdk/bin/java -XX:+UseParallelGC -XX:+HeapDumpAfterFullGC -Xms8g -Xmx8g HeapDump.java 2>&1 | grep created; rm *.hprof; done
# Before
Heap dump file created [1897307608 bytes in 1.584 secs]
Heap dump file created [1897308278 bytes in 1.439 secs]
Heap dump file created [1897308508 bytes in 1.460 secs]
Heap dump file created [1897308505 bytes in 1.423 secs]
Heap dump file created [1897308554 bytes in 1.414 secs]
# After
Heap dump file created [1897307648 bytes in 1.509 secs]
Heap dump file created [1897308498 bytes in 1.281 secs]
Heap dump file created [1897308554 bytes in 1.282 secs]
Heap dump file created [1897308512 bytes in 1.263 secs]
Heap dump file created [1897308554 bytes in 1.270 secs]
...which is about +12% faster heap dump.
I also eyeballed the generated code and saw `mask_dormant_archived_object` fully inlined at least on x86_64.
-------------
Commit messages:
- Fix
Changes: https://git.openjdk.org/jdk/pull/16863/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16863&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8320924
Stats: 41 lines in 3 files changed: 19 ins; 17 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/16863.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16863/head:pull/16863
PR: https://git.openjdk.org/jdk/pull/16863
More information about the hotspot-dev
mailing list