swebb2066 commented on PR #351:
URL: https://github.com/apache/logging-log4cxx/pull/351#issuecomment-1938079026

   > What's the reasoning behind the lazy initialization of m_priv? It makes 
the code harder to read IMO since you now have an extra check to see if it is 
valid, instead of just knowing that it always exists.
   
   Less memory and processor overhead (see the above benchmarks). 
   
   An application will create many loggers, but few (usually only the root 
logger) has attached appenders.
   
    Lazy initialization reduces memory alloc's by avoiding allocating 
`AppenderAttachableImpl::priv_data` (and initializing a std::mutex + 
std::vector) for all those loggers that do not have attached appenders.
   
   Throughput is improved because `appendLoopOnAppenders` does not acquire a 
lock for each decendent logger in the path to the root logger.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to