-
-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/format: buffer newlineWriter writes
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
- Loading branch information
1 parent
00bffce
commit cba1ebc
Showing
2 changed files
with
18 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters