r/cpp • • 2d ago

Comprehensive C++ Logging Benchmarks – 2026 Update & Quill v14

Benchmarks · GitHub

The updated benchmarks compare 11 C++ logging libraries on Linux (Intel and AMD) and Windows, covering call latency, throughput and compile times.

Quill, an asynchronous low-latency C++17 logging library that I maintain, has also reached v14.

As always, feedback is welcome!

26 Upvotes

8 comments sorted by

View all comments

3

u/El_RoviSoft 2d ago

Switched from spdlog to quill and absolutely love this library. Thx for you work.

Is there any particular reason why some other loggers (like BqLog) win in throughput?

7

u/odycsd 2d ago

Thanks, glad you like it!

Quill aims to keep its backend as efficient as possible, but the backend runs off the critical path: the calling thread only copies the arguments into its queue. So the backend favours flexibility over raw throughput.

Among the text loggers, XTR and BqLog's text mode are 10–15% ahead of Quill on Linux. File I/O is not the difference: all three use a 64 KiB buffer and write(), and the other two write as many bytes per line or more. The difference is the work done per message:

XTR compiles the whole line into one FMT_COMPILE format string per log statement, prefix and file:line included. The backend formats the line in a single pass with code generated for that statement. The layout is fixed at compile time, and each thread is expected to log through its own sink.

BqLog doesn't use {fmt}. Its own formatter reads built-in types straight from the record. Custom types are turned into a string on the calling thread. Doubles are printed with a fixed 15 decimals (0.500000000000000) using integer arithmetic, rather than fmt's shortest round-trip form. The prefix is fixed: a cached millisecond timestamp, a cached thread label, and no file:line.

Neither merges threads by timestamp: they write each thread's records in turn.

Where Quill's backend spends the extra work:

- It formats at runtime with {fmt} through type-erased arguments.

- It formats the message first, then builds the line from a pattern set at runtime (here with nanosecond timestamps and file:line), which is a second pass.

- It merges all threads into one file in timestamp order.

The benchmark doesn't measure these costs one by one, so it doesn't show which matters most.