mirror of
https://github.com/FiloSottile/age.git
synced 2026-01-05 03:43:57 +00:00
Most writes in the cmd/age Writer stack are chunk-sized, so approximately 64KiB. However, the newlineWriter, which splits lines at 64 columns, was doing a Write on the underlying Writer for each line, making chunks effectively 48 bytes (before base64). There is no buffering underneath it, so it was resulting in a lot of write syscalls. Add a reusable bytes.Buffer to buffer the output of each (*newlineWriter).Write call, and Write it all at once on the destination. This makes --armor just 50% slower than plain, instead of 10x. Fixes #167