PlatformLab / NanoLog

Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.
Other
3k stars 343 forks source link

Comparisson between preprocessor and C++17 #9

Open eucristian opened 5 years ago

eucristian commented 5 years ago

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

syang0 commented 5 years ago

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.