A binary log is a log whose records hold a statement identifier, a timestamp and the raw values of the statement’s arguments, not text; the statements’ format strings are stored once, in the log’s header or alongside the binary. Deferred formatting is the practice of turning such records into text only when the log is read, by a separate program, so that the program that writes the log never converts a number to text.
snprintf into a buffer, fprintf into a fully buffered file, and a string stream. Measured on a laptop (Intel Core Ultra 7 155H) under WSL2. Data: bench_log.py.