I always had the impression that Log4j `FixedDateFormat` is faster than
Commons `FastDateFormat` which is faster than Java `DateTimeFormatter`,
yet, unless I am doing something stupid, the picture is totally different
in Java 17:


*Benchmark                   (pattern)   Mode  Cnt     Score     Error
 Units*commonsFdf               HH:mm:ss.SSS  thrpt   12  6749.822 ±
692.047  ops/s
commonsFdf  yyyy-MM-dd'T'HH:mm:ss.SSS  thrpt   12  4377.318 ± 209.050  ops/s
javaDtf                  HH:mm:ss.SSS  thrpt   12  2515.950 ±  38.564  ops/s
javaDtf     yyyy-MM-dd'T'HH:mm:ss.SSS  thrpt   12  1794.764 ±  51.975  ops/s
log4jFdf                 HH:mm:ss.SSS  thrpt   12  1032.089 ±  65.850  ops/s
log4jFdf    yyyy-MM-dd'T'HH:mm:ss.SSS  thrpt   12   696.700 ±  40.708  ops/s

The sources and results can be reached from this GitHub repository
<https://github.com/vy/date-time-format-benchmark> and the associated
GitHub Actions workflow runs
<https://github.com/vy/date-time-format-benchmark/runs/4008433552>,
respectively.

The preliminary profiling points to
`FixedDateTime#millisSinceMidnight(long)` for the unexpected slowness of
`FixedDateTime`.

Would anybody mind confirming that the measurements make sense and
`FixedDateTime` is... broken?

Reply via email to