On Fri, 25 Mar 2022 12:28:58 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> Richard Startin prompted me to have a look at a case where java.time > underperforms relative to joda time > (https://twitter.com/richardstartin/status/1506975932271190017). > > It seems the java.time test of his suffer from heavy allocations due > ZoneOffset::getRules allocating a new ZoneRules object every time and escape > analysis failing to do the thing in his test. The patch here adds a simple > specialization so that when creating ZonedDateTimes using a ZoneOffset we > don't query the rules at all. This removes the risk of extra allocations and > slightly speeds up ZonedDateTime creation for both ZoneOffset (+14%) and > ZoneRegion (+5%) even when EA works like it should (the case in the here > provided microbenchmark). This pull request has now been integrated. Changeset: 7bac0a87 Author: Claes Redestad <redes...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/7bac0a878d918745ed036954cbbee590ce810c71 Stats: 156 lines in 5 files changed: 152 ins; 0 del; 4 mod 8283681: Improve ZonedDateTime offset handling Reviewed-by: scolebourne, naoto, rriggs ------------- PR: https://git.openjdk.java.net/jdk/pull/7957