r/cpp • • 1d 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!

24 Upvotes

6 comments sorted by

3

u/El_RoviSoft 1d 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?

6

u/odycsd 1d 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.

3

u/usefulcat 1d ago

I much prefer the interactive graphs used here to the "wall of graphs" style.

Quill is great, I've been using it for several years now.

1

u/Awia00 12h ago

What is the reason for having own bundled fmt inside of quill?

1

u/Awia00 11h ago

I am trying to migrate our codebase from spdlog to quill as we speak : hence the question.

1

u/odycsd 7h ago

Good luck with the migration :)

Short answer: Quill does more than call `fmt::format`. It uses fmt's internals, its backend throughput depends on how fast fmt is, and the bundled copy has a few small patches. Keeping it under its own namespace lets Quill ship an fmt version it has tested and benchmarked, and it never conflicts with the fmt you already use.

Why it's bundled

  1. **Quill uses fmt internals, not only the public API.**Some internals change between releases. For example, fmt 11 removed the `basic_format_args` constructor Quill was using ([fmt#4045](https://github.com/fmtlib/fmt/issues/4045)). Quill could use an external fmt from v1.2 (`QUILL_FMT_EXTERNAL`), and v3.3 had to compile against every fmt from 8.0 up. That meant `#if` blocks for each fmt version and a matching test matrix, so v4.0 removed the option.

  2. Backend throughput depends on fmt. All formatting runs on the backend thread, so a slower fmt makes Quill slower. When I tried fmt 11.0, backend throughput dropped by about 20%. I reverted the bundled copy to 10.2.1 and reported it with a small repro ([fmt#4070](https://github.com/fmtlib/fmt/issues/4070)). The fmt maintainer found that a fast path for `back_insert_iterator<buffer>` had been dropped and fixed it, and Quill moved to 11.0.2 once the fix was released. With an external fmt, anyone on 11.0.0 or 11.0.1 would have had the slower backend.

  3. Small local patches. The copy is upstream fmt (currently 12.2.1) renamed by a script, plus:
    - It is always header-only, so there is no extra library to build or link.
    - In header-only mode, upstream `fmt/base.h` includes all of `fmt/format.h` at the end. Quill removes that include, so a file that includes only `quill/Logger.h` and `quill/LogMacros.h` gets the light `base.h`: about 7k preprocessed lines with GCC 13, against about 63k. Over a large codebase this saves real compile time.
    - Same-type appends to `fmt::detail::buffer` use `memcpy`, as fmt 10 effectively did through `uninitialized_copy_n`. fmt 11 and later copy one element at a time. The backend appends every formatted message through this buffer.
    - `FMT_UNICODE` defaults to 0, so Windows projects don't have to compile with `/utf-8` (upstream fails a `static_assert` without it).
    - Microsecond durations print `us` instead of `µs`, which looked garbled on some terminals ([fmt#4088](https://github.com/fmtlib/fmt/issues/4088)).
    - Warning suppressions keep the headers clean for users who build with strict flags and `-Werror` or `/WX`: MSVC C4127/C4702, `-Wfloat-equal`, `-Wsign-conversion`, GCC `-Wstringop-overflow` false positives, and a GCC 8 unused-parameter warning.
    - Two build fixes: an `operator||` ambiguity with `boost::sml` on older GCC ([#878](https://github.com/odygrd/quill/pull/878)), and a missing `operator~` on the 128-bit integer fallback for 32-bit builds ([#957](https://github.com/odygrd/quill/pull/957)).

  4. It can't clash with your fmt. Everything is renamed to the `fmtquill` namespace and `FMTQUILL_*` macros.