[
https://issues.apache.org/jira/browse/LOG4J2-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma resolved LOG4J2-1097.
---------------------------------
Resolution: Fixed
Fixed in git master in commit c18acf17.
DatePatternConverter now uses FixedDateFormat for predefined date patterns (and
variations that use a '.' period millisecond separator instead of ',').
> [Perf] Custom TimeFormat
> ------------------------
>
> Key: LOG4J2-1097
> URL: https://issues.apache.org/jira/browse/LOG4J2-1097
> Project: Log4j 2
> Issue Type: Improvement
> Components: Layouts, Pattern Converters
> Affects Versions: 2.3
> Reporter: Remko Popma
> Assignee: Remko Popma
> Fix For: 2.4
>
>
> In addition to the work done for LOG4J2-812 (replace synchronized
> SimpleDateFormat with commons FastDateFormat) I see a way to improve
> performance for the timestamp even further.
> Ralph posted some very nice JMH benchmark results in LOG4J2-812, where the
> combination of caching, FastDateFormat and an AtomicReference was the winner.
> I believe this is the way to go, but we may be able to do even better. For
> some common date formats, it is possible to get a 5X speedup versus
> FastDateFormat.
> This is not as generic as FastDateFormat; at the moment it only supports
> {{HH:mm:ss,SSS}}. I would like to support the "common" DatePatternConverter
> formats ABSOLUTE, COMPACT, DATE_AND_TIME, DEFAULT, ISO8601_BASIC and ISO8601.
> For any other date format pattern we fall back to FastDateFormat.
> Performance results are below (benchmark is in git master):
> {noformat}
> Benchmark Mode
> Samples Score Error Units
> o.a.l.l.p.j.TimeFormatBenchmark.baseline sample
> 118021 18.783 ± 0.842 ns/op
> o.a.l.l.p.j.TimeFormatBenchmark.customBitFiddlingFormatString sample
> 157268 87.616 ± 1.557 ns/op
> o.a.l.l.p.j.TimeFormatBenchmark.customFormatString sample
> 170168 82.650 ± 1.326 ns/op
> o.a.l.l.p.j.TimeFormatBenchmark.customFormatStringBuilder sample
> 108884 67.825 ± 1.577 ns/op
> o.a.l.l.p.j.TimeFormatBenchmark.fastDateFormatString sample
> 148478 317.145 ± 1.850 ns/op
> o.a.l.l.p.j.TimeFormatBenchmark.simpleDateFormatString sample
> 173226 263.886 ± 10.615 ns/op{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]