Remko Popma created LOG4J2-1339:
-----------------------------------

             Summary: AsyncLogger should not call instanceof TimestampMessage 
in hot path
                 Key: LOG4J2-1339
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1339
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.5, 2.4.1, 2.4, 2.3, 2.2, 2.1, 2.0.2, 2.0.1
            Reporter: Remko Popma
            Assignee: Remko Popma
             Fix For: 2.6


With LOG4J2-744, AsyncLogger attempts to get the time from the message by 
calling
{code}
millis = message instanceof TimestampMessage ? ((TimestampMessage) 
message).getTimestamp() : CLOCK.currentTimeMillis()
{code}
for every message. The vast majority of messages are not TimestampMessages so 
the time is eventually obtained from the clock. However, benchmarking shows 
that the {{instanceof}} check is not free.

It gives better performance to postpone the above logic to the background 
thread.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to