You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "David Schlosnagle (Jira)" <ji...@apache.org> on 2022/07/23 05:54:00 UTC
[jira] [Created] (LOG4J2-3560) Logger$PrivateConfig.filter(Level, Marker, String) allocates empty varargs array
David Schlosnagle created LOG4J2-3560:
-----------------------------------------
Summary: Logger$PrivateConfig.filter(Level, Marker, String) allocates empty varargs array
Key: LOG4J2-3560
URL: https://issues.apache.org/jira/browse/LOG4J2-3560
Project: Log4j 2
Issue Type: Improvement
Components: Core
Reporter: David Schlosnagle
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:
{code}
at org.apache.logging.log4j.core.Logger$PrivateConfig.filter(Level, Marker, String)
at org.apache.logging.log4j.core.Logger.isEnabled(Level, Marker, String)
{code}
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)