From 70fdb359f0b1b2f47e1b1f3fbf46763edeb777cd Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 17 Oct 2026 00:02:16 +0200 Subject: [PATCH] Describe the sinks of the binary writer in the architecture page The page listed the output adapters only. The binary writer writes through a sink: a non-virtual one that appends to the vector of the vector-returning to_* functions, and one that collects the output for the adapters of the other overloads and passes it on in blocks. Signed-off-by: Niels Lohmann --- docs/mkdocs/docs/home/architecture.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/mkdocs/docs/home/architecture.md b/docs/mkdocs/docs/home/architecture.md index 51ce62fda..295ea09ba 100644 --- a/docs/mkdocs/docs/home/architecture.md +++ b/docs/mkdocs/docs/home/architecture.md @@ -339,6 +339,11 @@ The `serializer` (used by [`dump`](../api/basic_json/dump.md) and [`operator<<`] - `output_stream_adapter` writes to a `std::ostream`. - `output_string_adapter` appends to a string. +The `binary_writer` does not call an adapter for every byte. The `to_*` functions that return a `std::vector` write +into the vector through a sink (`output_vector_sink`) that is not virtual. The functions that take an output adapter +write through a sink (`output_adapter_sink`) that collects the output in a buffer of one kibibyte and passes it to the +adapter in blocks, so that the adapter is called (and a stream locked) once per block instead of once per value. + ## Value conversion Values are converted from and to other types with the `JSONSerializer` template parameter. The default,