carterkozak commented on pull request #573:
URL: https://github.com/apache/logging-log4j2/pull/573#issuecomment-924387654


   >  imagine the results may depend on the distinct number and shape of 
formatter patterns used in an application, as that may push C2 to optimize 
differently for monomorphic, bimorphic, or megamorphic calls and some of the 
potential pitfalls of class hierarchy optimizations
   
   @schlosna In this case the additional subclasses shouldn't impact overall 
performance because the PatternLayout operates with an array of 
LogEventPatternConverter instances based on the input pattern. There are dozens 
of types that may be used, we're exchanging some for others to reduce the 
variables introduced into the system.
   
   Running with java 11:
   
   This PR:
   
   ```
   $ java -jar log4j-perf/target/benchmarks.jar 
".*PatternLayoutBenchmark.serializableMCDEx" -f 1 -wi 4 -i 4 -w 4s -r 4s -t 1 
-bm avgt
   ...
   Benchmark                                 Mode  Cnt   Score    Error  Units
   PatternLayoutBenchmark.serializableMCDEx  avgt    4  84.154 ± 10.530  ns/op
   ```
   
   (second run after running both branches a first time, to verify the results 
are reproducible)
   ```
   Benchmark                                 Mode  Cnt   Score    Error  Units
   PatternLayoutBenchmark.serializableMCDEx  avgt    4  87.192 ± 16.008  ns/op
   ```
   
   Compared to the 2.x branch:
   ```
   java -jar log4j-perf/target/benchmarks.jar 
".*PatternLayoutBenchmark.serializableMCDEx" -f 1 -wi 4 -i 4 -w 4s -r 4s -t 1 
-bm avgt
   ...
   Benchmark                                 Mode  Cnt    Score   Error  Units
   PatternLayoutBenchmark.serializableMCDEx  avgt    4  152.972 ± 2.614  ns/op
   ```
   
   Second run of release-2.x after the second run of the PR branch:
   ```
   Benchmark                                 Mode  Cnt    Score   Error  Units
   PatternLayoutBenchmark.serializableMCDEx  avgt    4  154.212 ± 8.509  ns/op
   ```


-- 
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