swebb2066 commented on pull request #94: URL: https://github.com/apache/logging-log4cxx/pull/94#issuecomment-1003641406
To determine the cost of Logger holding a weak pointer instead of a raw pointer as in this PR, I experimently changed m_priv->repository to a std::weak_ptr. The result shows calls to isDisabled() from multiple threads are some what serialized. The per thread throughput is less half the single thread throughput. throughputtests output with Logger holding a weak pointer: ``` Benchmarking library only(no writing out): ************************************************************** Benchmarking Single threaded: 1000000 messages ************************************************************** Log4cxx NoFormat pattern: %m%n Elapsed: 5.001 secs 199,972/sec Log4cxx DateOnly pattern: [%d] %m%n Elapsed: 5 secs 200,001/sec Log4cxx DateClassLevel pattern: [%d] [%c] [%p] %m%n Elapsed: 5.01 secs 199,591/sec Log4cxx Logging with FMT Elapsed: 2.576 secs 388,129/sec Log4cxx Logging static string Elapsed: 3.279 secs 304,998/sec Log4cxx Logging static string with FMT Elapsed: 2.807 secs 356,189/sec Log4cxx Logging disabled debug Elapsed: 0.1941 secs 5,152,795/sec Log4cxx Logging disabled trace Elapsed: 0.1938 secs 5,159,546/sec Log4cxx Logging enabled debug Elapsed: 3.322 secs 301,064/sec Log4cxx Logging enabled trace Elapsed: 3.295 secs 303,469/sec ************************************************************** Benchmarking multithreaded threaded: 1000000 messages/thread, 4 threads ************************************************************** Log4cxx Logging with FMT MT Elapsed: 4.526 secs 220,932/sec Log4cxx Logging with FMT MT Elapsed: 4.553 secs 219,640/sec Log4cxx Logging with FMT MT Elapsed: 4.708 secs 212,424/sec Log4cxx Logging with FMT MT Elapsed: 4.727 secs 211,554/sec ************************************************************** Benchmarking multithreaded disabled: 1000000 messages/thread, 4 threads ************************************************************** Log4cxx Logging disabled MT Elapsed: 0.4405 secs 2,270,056/sec Log4cxx Logging disabled MT Elapsed: 0.4408 secs 2,268,693/sec Log4cxx Logging disabled MT Elapsed: 0.4505 secs 2,219,599/sec Log4cxx Logging disabled MT Elapsed: 0.4569 secs 2,188,823/sec ``` And LOGCXX-322 is still a problem. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
