You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Writing MimeMessage#writeTo(OutputStream) to an unbuffered instead of a buffered output stream leads to extreme performance degradation by factors greater that 100.
To Reproduce
Steps to reproduce the behavior:
Create 1000 MimeMessages in a loop and write them to an unbuffered output stream, e.g. java.nio.file.Files#newOutputStream(Path)
Measure the time taken in comparison to buffered output streams.
Expected behavior
Either it should be documented that the MimeMessage#writeTo(OutputStream) requires a buffered output stream to get reasonable performance, or the method itself should use a (small) internal buffer to ensure reasonable write performance even in cases where no buffered output stream is used.
Desktop (please complete the following information):
OS: Windows 2012 Server, Windows 10
Mail server:
N.A.
The text was updated successfully, but these errors were encountered:
Buffering is handled at the transport layers where there are additional restrictions about if and when buffering can be used. I would assume that the benchmark results will vary based on the number of addresses, session properties, and content size and content type of the MimeMessage.
That said the simple change would be to add a see reference to java.io.BufferedOutputStream and later consider using transferTo inside of the various mime classes when we require JDK 9+.
Describe the bug
Writing
MimeMessage#writeTo(OutputStream)
to an unbuffered instead of a buffered output stream leads to extreme performance degradation by factors greater that 100.To Reproduce
Steps to reproduce the behavior:
MimeMessage
s in a loop and write them to an unbuffered output stream, e.g.java.nio.file.Files#newOutputStream(Path)
Expected behavior
Either it should be documented that the
MimeMessage#writeTo(OutputStream)
requires a buffered output stream to get reasonable performance, or the method itself should use a (small) internal buffer to ensure reasonable write performance even in cases where no buffered output stream is used.Desktop (please complete the following information):
Mail server:
The text was updated successfully, but these errors were encountered: