<i18n dev> RFR: 8304976: Optimize DateTimeFormatterBuilder.ZoneTextPrinterParser.getTree() [v2]
    Sergey Tsypanov 
    stsypanov at openjdk.org
       
    Wed Mar 29 08:16:32 UTC 2023
    
    
  
> 1) When `DateTimeFormatter` is reused we don't need to copy `availableZoneIds` and allocate `nonRegionIds` as PrefixTree can be taken from cache. In the related benchmark allocation of `HashSet` takes ~93% of all time, so avoiding it should bring some improvement for cases when we reuse `DateTimeFormatter` to parse a string into `ZoneDateTime`
> 
> 
> 2) `DateTimeFormatter` is mostly used with one locale, so `cachedTree` and `cachedTreeCI` can have predefined size.
> 
> 
> @State(Scope.Thread)
> @BenchmarkMode(Mode.AverageTime)
> @OutputTimeUnit(TimeUnit.NANOSECONDS)
> public class DateTimeFormatterBenchmark {
> 
>     private static final DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern("yyyy:MM:dd:HH:mm:v").toFormatter();
>     private static final String TEXT = "2015:03:10:12:13:ECT";
> 
>     @Setup
>     public void setUp() {
>         ZonedDateTime.parse(TEXT, df);
>     }
> 
>     @Benchmark
>     public ZonedDateTime parse() {
>         return ZonedDateTime.parse(TEXT, df);
>     }
> }
Sergey Tsypanov has updated the pull request incrementally with one additional commit since the last revision:
  8304745: Fix package
-------------
Changes:
  - all: https://git.openjdk.org/jdk/pull/12612/files
  - new: https://git.openjdk.org/jdk/pull/12612/files/b542ae06..623a7730
Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12612&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12612&range=00-01
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/12612.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/12612/head:pull/12612
PR: https://git.openjdk.org/jdk/pull/12612
    
    
More information about the i18n-dev
mailing list