RFR: 8337832: Optimize datetime toString

Shaojin Wen duke at openjdk.org
Sun Aug 11 11:37:32 UTC 2024


On Sat, 27 Jul 2024 13:45:11 GMT, Shaojin Wen <duke at openjdk.org> wrote:

> Similar to PR #20321, this improves performance by providing a method that passes in a StringBuilder to avoid unnecessary object allocation.

Below are the performance numbers on the MacBook M1 Pro. In the zonedDateTimeToString scenario, the performance is improved by 44.81%


#baseline 
git checkout 034297a6bd9bfcea7fa48792f54c84a6e976b319
make test TEST="micro:java.time.ToStringBench.zonedDateTimeToString"

Benchmark                             Mode  Cnt  Score   Error   Units
ToStringBench.zonedDateTimeToString  thrpt   15  8.979 ? 0.206  ops/ms

# current
git checkout 9d7cc54c449d4e12d0eb30c103e8aa3aaf206b6d
make test TEST="micro:java.time.ToStringBench.zonedDateTimeToString"

Benchmark                             Mode  Cnt   Score   Error   Units
ToStringBench.zonedDateTimeToString  thrpt   15  13.003 ? 0.214  ops/ms +44.81%

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

PR Comment: https://git.openjdk.org/jdk/pull/20368#issuecomment-2282727944


More information about the core-libs-dev mailing list