ppkarwasz commented on PR #3338:
URL: https://github.com/apache/logging-log4j2/pull/3338#issuecomment-2565768511

   Here are the results of the `InstantPatternFormatterBenchmark` using:
   
   - Temurin 22.0.2
   - 32 threads of an AMD EPYC 7351P 16-Core processor (with hyperthreading)
   
   Each operation formats 1000 timestamps that differ less than a second 
between each other.
   
   ### Reference
   
   | Formatter type | Format | Score | Error | Units |
   | --- | --- | --- | --- | --- |
   | `FastDatePrinter` | `yyyy-MM-dd'T'HH:mm:ss.SSS` | 76.0 | ±0.87 | kops/ms |
   | `FastDatePrinter` | `HH:mm:ss.SSS` | 119.1 | ±2.3 | kops/ms |
   | `FixedDateFormat` | `yyyy-MM-dd'T'HH:mm:ss.SSS` | 632.6 | ±.35 | kops/ms |
   | `FixedDateFormat` | `HH:mm:ss.SSS` | 632.8 | ±.32 | kops/ms |
   | `DateTimeFormatter` | `yyyy-MM-dd'T'HH:mm:ss.SSS` | 16.0 | ±6.4 | kops/ms |
   | `DateTimeFormatter` | `HH:mm:ss.SSS` | 43.9 | ±16.8 | kops/ms |
   
   Where `FastDatePrinter` and `FixedDateFormat` are legacy Log4j Core 2 
formatters.
   
   ### Before
   
   | Formatter type | Format | Score | Error | Units |
   | --- | --- | --- | --- | --- |
   | `InstantPatternFormatter` | `yyyy-MM-dd'T'HH:mm:ss.SSS` | 23.3 | ±6.3 | 
kops/ms |
   | `InstantPatternFormatter` | `HH:mm:ss.SSS` | 28.0 | ±3.5 | kops/ms |
   
   ### After
   
   | Formatter type | Format | Score | Error | Units |
   | --- | --- | --- | --- | --- |
   | `InstantPatternFormatter` | `yyyy-MM-dd'T'HH:mm:ss.SSS` | 246.0 | ±6.0 | 
kops/ms |
   | `InstantPatternFormatter` | `HH:mm:ss.SSS` | 248.9 | ±5.5 | kops/ms |
   
   I wouldn't attach too much importance to the precise numbers, since 
`DateTimeFormatter` seems to suffer from some multi-threading issues, but the 
performance has clearly improved.
   
   Running the benchmark on a single thread for the two best performing 
implementations gives:
   
   - Around 34.5 kops/ms for `FixedDateFormat`.
   - Around 12.7 kops/ms for `InstantPatternFormatter`.
   
   Note that `FixedDateFormat` only supports specific date formats, while 
`InstantPatternFormatter` supports all the date formats. 20 µs per operation 
seems a fair price to pay for flexibility.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to