[ https://issues.apache.org/jira/browse/CXF-1916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648361#action_12648361 ]
Daniel Kulp commented on CXF-1916: ---------------------------------- The proposed implementation doesn't quite work in all cases, but I think I have it updated to work OK and I should have it committed soon (providing all the tests pass). Basically, the stuff that didn't work: 1) The "read()" method didn't do any boundary checks. Thus, if something used that method, we'd have problems. Just forwarded that into the read(byte[], 0, 1) call; 2) When calling read(byte[], int off, int len), if the "len" was always less than the boundary length, there was no way to detect if a boundary was reached. It would just loop returning 0. Now, if the len < boundary detection requirements, it uses an internal buffer and will pushback excess. This is actually a bit slower than the old implementation if the "len <= 6", but that shouldn't be a "normal" case I don't think. > Mtom Performance - MimeBodyPartInputStream performs slow > -------------------------------------------------------- > > Key: CXF-1916 > URL: https://issues.apache.org/jira/browse/CXF-1916 > Project: CXF > Issue Type: Improvement > Components: Core > Affects Versions: 2.0.7 > Environment: Windows XP, Java SE 1.6.0_06 > Reporter: Mayank Mishra > Assignee: Daniel Kulp > Priority: Minor > Attachments: MimeBodyPartInputStream.java, TestMBPIS.java > > > MimeBodyPartInputStream doesn't implements read(byte[]), hence it delegates > it to parent InputStream class. InputStream's read(byte[]) runs over a for > loop, eventually delegating to PushBackInputStream, which reads a single byte > and performs boundary matching over that Byte. > A simple test program which takes the time taken by the > MimeBodyPartInputStream to read from a loaded buffer shows that > MimeBodyPartInputStream takes ~1200-1400 ms to read a 12MB buffer. On the > other hand, an InputStream takes around ~100-150ms to do so. I can understand > that MimeBodyPartInputStream has the logic of detecting a probable boundary > and it performs multiple if checks to do so, also it calls read and unread > over PushBackInputStream. But counting the reads and unreads also, the time > of MimeBodyPartInputStream looks poor. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.