RFR: 8355636: Reuse StringBuilder in printStackTrace [v7]
Per Minborg
pminborg at openjdk.org
Mon Apr 28 07:14:48 UTC 2025
On Sat, 26 Apr 2025 22:42:08 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> 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%.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>
> Update src/java.base/share/classes/java/lang/Throwable.java
>
> Co-authored-by: Hendrik Schick <30866028+ky0n at users.noreply.github.com>
As pointed out by several reviewers above, the weighted overall benefit of this PR might be negative. Reviewers carefully need to weigh pros and cons in a plurality of dimensions, including, but not limited to:
* Consensus in pre-communicated suggestions on the relevant mailing list
* Readability
* Complexity
* Integrity
* Maintainability
* Adherent to current and future features
* Test coverage and testability
* Reviewer utilization (i.e., value over other potentially more important issues to review)
* Archaeology
* Performance
* Resource utilization
You need to up-level and address questions like this before it becomes meaningful to spend reviewing resources on this and similar PRs.
Hence, I am expecting comments rather than code from you @wenshao in this PR until we have established that the net benefit of this PR (contrary to the beliefs of many reviewers) can ever be positive.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24864#issuecomment-2834195602
More information about the core-libs-dev
mailing list