Closed swebb2066 closed 10 months ago
On Ubuntu gcc 9, benchmarks improve to: | Benchmark | Time | CPU | Iterations |
---|---|---|---|---|
Testing disabled logging request | 0.475 ns | 0.475 ns | 1000000000 | |
Testing disabled logging request/threads:16 | 0.092 ns | 1.01 ns | 674392480 | |
Logging 5 char string using MessageBuffer, pattern: %m%n | 295 ns | 295 ns | 2369056 | |
Logging 5 char string using MessageBuffer, pattern: %m%n/threads:16 | 456 ns | 3678 ns | 203328 | |
Logging 49 char string using MessageBuffer, pattern: %m%n | 329 ns | 329 ns | 2124660 | |
Logging 49 char string using MessageBuffer, pattern: %m%n/threads:16 | 428 ns | 3500 ns | 172976 | |
Logging int value using MessageBuffer, pattern: %m%n | 513 ns | 513 ns | 1365225 | |
Logging int value using MessageBuffer, pattern: %m%n/threads:16 | 457 ns | 3705 ns | 188320 | |
Logging int+float using MessageBuffer, pattern: %m%n | 906 ns | 906 ns | 769372 | |
Logging int+float using MessageBuffer, pattern: %m%n/threads:16 | 440 ns | 3644 ns | 171664 | |
Logging int value using MessageBuffer, pattern: [%d] %m%n | 516 ns | 516 ns | 1368021 | |
Logging int value using MessageBuffer, pattern: [%d] [%c] [%p] %m%n | 515 ns | 515 ns | 1371139 | |
Logging 49 char string using FMT, pattern: %m%n | 288 ns | 288 ns | 2433169 | |
Logging 49 char string using FMT, pattern: %m%n/threads:16 | 367 ns | 2972 ns | 204304 | |
Logging int value using FMT, pattern: %m%n | 316 ns | 316 ns | 2175223 | |
Logging int value using FMT, pattern: %m%n/threads:16 | 430 ns | 3481 ns | 199248 | |
Logging int+float using FMT, pattern: %m%n | 451 ns | 451 ns | 1553304 | |
Logging int+float using FMT, pattern: %m%n/threads:16 | 450 ns | 3659 ns | 187680 | |
Async, int value using MessageBuffer, pattern: %m%n | 512 ns | 512 ns | 1367661 | |
Async, int value using MessageBuffer, pattern: %m%n/threads:16 | 516 ns | 4199 ns | 196688 |
I thought I had seen in one of the other PRs that you had done something like:
callAppenders(event, this->pool);
Was that not the case? I would imagine that just passing the same pool around would be better since it would not continuously allocate new pools.
done something like: callAppenders(event, this->pool);
Yes. That was my initial commit to #333. However, I later realized that was an error as the additions to the APR pool in callAppenders
need to be freed after callAppenders
return. So the separate APR sub-pool is needed to prevent unbounded memory growth in the long lived pool held by the Hierarchy
object.
Most appenders no longer alloc memory from an APR pool (exceptions are ODBCAppender, SMTPAppender, etc). This is the reason this PR achieves much better performance than #333
This PR improves benchmarks more than #333.