[ 
https://issues.apache.org/jira/browse/LOG4J2-3560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572064#comment-17572064
 ] 

Carter Kozak commented on LOG4J2-3560:
--------------------------------------

Thanks for the fix! I've applied it to both release-2.x and master branches.

> 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
>    Affects Versions: 2.18.0
>            Reporter: David Schlosnagle
>            Assignee: Carter Kozak
>            Priority: Major
>             Fix For: 2.18.1
>
>
> 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)

Reply via email to