PlatformLab / NanoLog

Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comparisson between preprocessor and C++17

eucristian opened this issue · comments

Hello,

Could you please update the ReadMe with the expected performance difference(in your opinion) between the pre-processor version and the C++17 one? Thank you very much

I'll update the README more formally at a later point, but informally, we expect the amortized performance of the two to be pretty much the same. Here "amortized" means you've logged a particular log message more than a few times.

The reason for this difference is that NanoLog C++17 executes additional logic when it encounters a log message it's never seen before. However, this only happens at most once per unique log message statement and the logic is fairly simple (grab a lock and push a pointer on a vector). After that point, the two implementations are nearly identical, so we do not expect their amortized performance to vary very much.