RFR: 8368172: Make java.time.format.DateTimePrintContext immutable

Shaojin Wen swen at openjdk.org
Sat Sep 20 16:54:19 UTC 2025


On Sat, 20 Sep 2025 14:04:30 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> What is the performance data that makes justifies this change? Its not enough to just want to make things constant.

The current branch is just a refactoring; there's no performance improvement on MacBook M1 Pro.

Further changes are needed to enable the "EliminateAllocations" optimization to work, achieving the goal of eliminating the allocation of DateTimePrintContext and StringBuilder objects in the `j.t.f.DateTimeFormatter#format` method, thus resulting in significant performance improvements.

My plan is to optimize the performance of `j.t.f.DateTimeFormatter#format`.  I've put the proposed changes in Draft Pull Request #26807, but it's a major change, and would be difficult to review all at once.

Therefore, I've broken this process down into multiple PRs, including the current PR #26913, another PR #26911, and the already merged PR #26633.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26913#issuecomment-3315100843


More information about the core-libs-dev mailing list