Closed lilyball closed 5 years ago
StdoutLock
is actually a wrapper around a line-buffered writer already, but for some reason it's faster to do this. I guess the line-buffered writer is still doing a bunch of work per-write.
Unfortunately I don't see any way to get a non-buffered writer short of dropping down to RawFd
/RawHandle
.
Thank you very much!
Running them through an in-memory buffer first produces a 25% speedup (when tested against a 1.3MB file).
Also bump the buffer size to 256 bytes. On my machine this pushes it to a 33% speedup.