Description
While reviewing some JFR profiles, I notice significant allocations of Object[] due to use of some isEnabled conditions that ends up using empty varargs invoking org.apache.logging.log4j.core.Filter#filter(Logger, Level, Marker, String, Object...), for example the following call trace:
at org.apache.logging.log4j.core.Logger$PrivateConfig.filter(Level, Marker, String) at org.apache.logging.log4j.core.Logger.isEnabled(Level, Marker, String)
We can avoid allocation on this hot path when invoking Filter#filter(Logger, Level, Marker, String, Object...) by reusing an empty object array for the varargs.
Attachments
Issue Links
- relates to
-
LOG4J2-3566 DefaultLogBuilder is not garbage-free
- Open
- links to