You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/08/22 21:07:00 UTC

[jira] [Commented] (LOG4J2-3560) Logger$PrivateConfig.filter(Level, Marker, String) allocates empty varargs array

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

ASF subversion and git services commented on LOG4J2-3560:
---------------------------------------------------------

Commit f167c5198c501466e84592be21082dbebf87f922 in logging-log4j2's branch refs/heads/slf4j-2.0 from David Schlosnagle
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=f167c5198c ]

LOG4J2-3560: Logger$PrivateConfig.filter(Level, Marker, String) varargs does not allocate (#974)

Logger$PrivateConfig.filter(Level, Marker, String) varargs does not allocate
The Filter interface provides a new default method matching the unrolled varargs
method, with zero arguments.

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