If a user calls dbgln
, outln
or warnln
, then their formatted output will be nicely buffered by AK::PrintfImplementation (well, a derived class of that class).
However, the implementations of printf
, fprintf
wprintf
, and wfprintf
simply call PrintfImplementation::printf_internal, which takes a putc
function-like template argument to write one byte at a time.
This means, in essence, that if you have an unbuffered stream like stderr
, or one that the user invoked setbuf(stream, nullptr)
on, then calling
fprintf(stderr, "Hi\n");
will actually invoke the write() syscall once per character!
The LibC methods should be re-written to use the actual PrintfImplementation class, using their internal buffers (as determined by BUFSIZ
or setbuf/setvbuf
or some other stack-local buffer, so that doing a printf() or fprintf() isn't calling fputc or putc once per output character of every string they are processing.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too
We use tracking cookies to understand how you use the product and help us improve it.