RFR: 8320924: Improve heap dump performance by optimizing archived object checks
Yi Yang
yyang at openjdk.org
Wed Nov 29 02:25:05 UTC 2023
On Tue, 28 Nov 2023 20:24:17 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> 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.
Looks reasonable
-------------
Marked as reviewed by yyang (Committer).
PR Review: https://git.openjdk.org/jdk/pull/16863#pullrequestreview-1754300831
More information about the hotspot-dev
mailing list