In the Throwable::printStackTrace method, StringBuilder is created multiple times to build String. By sharing StringBuilder to build String, object allocation and copying are reduced.
In the scenario without suppressed and ourCause, unused IdentityHashMap is not created.
Through these optimizations, the performance of new Exception().printStackTrace() can be improved by about 10%.
In the scenario without suppressed and ourCause, unused IdentityHashMap is not created.
Through these optimizations, the performance of new Exception().printStackTrace() can be improved by about 10%.
- links to
-
Review(master) openjdk/jdk/24864