Package: libmime-tools-perl Version: 5.508-1 (Issue believed to be still present in the latest version 5.509-1.)
When base64-encoding a large file, MIME::Decoder processes it 45 bytes at a time. The resulting function call (and, depending on the application, system call) overhead can be very noticeable. I've seen RT (Debian package request-tracker4) hit a 40-second timeout while encoding a 8MB attachment because of this. Significant gains can be had by telling the encoder to process the file in larger chunks; I've set $EncodeChunkLength = 120*57 with good results. This takes advantage of the fact that MIME::Base64::encode_base64() will split the output into 76-byte lines by default; the feature has been documented since at least version 2.04 of MIME::Base64 (the minimum version required by MIME::Decoder::Base64). Maybe the encode chunk length should somehow be made configurable. If output is to a pipe one may want not to exceed the pipe buffer size (currently 64kB in Linux, but it can be smaller on other operating systems).