remkop commented on issue #335: Import of LogstashLayout as JsonTemplateLayout URL: https://github.com/apache/logging-log4j2/pull/335#issuecomment-580075777 Showing only the average in ns/operation: ``` NoOp sample 27754662 492.377 ± 6.634 ns/op ThreadLocal sample 20835106 352.366 ± 0.354 ns/op RightProvisionedJc sample 20989233 599.494 ± 0.432 ns/op UnderProvisionedJc sample 20839035 624.378 ± 3.719 ns/op ``` **What do these numbers mean?** It is the number of nanoseconds it takes on average to serialize a log event into a StringBuilder using the `%d %5p [%t] %c{1} %X{transactionId} - %m%n` PatternFormat. (Note that the log event has no context data, so the `%X{transactionId}` formatter is skipped.) **What can we conclude from these numbers?** The `NoOp` benchmark should be renamed `Allocate`, because it creates a `new StringBuilder(1024)` every invocation. Allocation does not seem too expensive here. Perhaps you have a lot of memory and the benchmark finishes before GC kicks in? The `ThreadLocal` benchmark shows it is a bit faster to reuse an existing StringBuilder instance cached in a ThreadLocal. The `Jc` benchmarks use the `org.jctools.queues.MpmcArrayQueue` data structure which seems a bit slower than a simple `ThreadLocal`. @vy Does that answer your question?
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services