RFR: 8349189: Speed up DateTime parse & format via Class File API [v12]
Shaojin Wen
swen at openjdk.org
Thu Mar 27 05:49:35 UTC 2025
> By using the Class File API to dynamically generate a CompositePrinterParser, and defining DateTimePrinterParser[] printerParsers as a specific field, C2 can do TypeProfile optimization.
>
> Since the CompositePrinterParser is generated based on the pattern, we can make the following optimizations:
>
> 1. For example, for the parse and print of Month/DayOfMonth/Hour/Minute/Second with a fixed length of 2, do targeted parse and print optimization.
>
> 2. Parse uses LocalDate/LocalTime/LocalDateTime/OffsetDateTime for TemporalQuery to avoid the overhead of constructing DateTimeParseContext.
>
> These optimizations can significantly improve performance, with more than 100% performance improvement in many scenarios.
Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 26 commits:
- Merge remote-tracking branch 'upstream/master' into datetime_fmt_202502
# Conflicts:
# src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
- more use getInt & add more test
- refactor test
- more test
- code style
- code style
- add instance test
- add test and bug fix
- speed up format via wrapper
- use get & formatInt
- ... and 16 more: https://git.openjdk.org/jdk/compare/24833403...c8528dd8
-------------
Changes: https://git.openjdk.org/jdk/pull/23384/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23384&range=11
Stats: 2090 lines in 9 files changed: 1948 ins; 88 del; 54 mod
Patch: https://git.openjdk.org/jdk/pull/23384.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23384/head:pull/23384
PR: https://git.openjdk.org/jdk/pull/23384
More information about the core-libs-dev
mailing list