[ https://issues.apache.org/jira/browse/CXF-1916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648114#action_12648114 ]
Mayank Mishra commented on CXF-1916: ------------------------------------ An alternative implementation of MimeBodyPartInputStream implements read(byte[] buffer, int off, int len) implementation. It reads the buffer, process boundary match over it. I am attaching a Test program named as TestMBPIS, which checks the performance of the 1, Trunk's implementation of MBPIS (MimeBodyPartInputStream), 2. PushBackInputStream (just to get an idea the time require to read 12MB of buffer, although it doesn't have any boundary matching logic) 3. Alternative implementation of MBPIS (private inner class named as MyMimeBodyPartInputStream, which does exactly the same work as current MimeBodyPartInputStream). The timings are (12 MB of data): 1. ~1578 ms (current MBPIS) 2. ~172 ms (just read raw 12MB data) 3. ~188 ms (alternate MBPIS) > 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 > Priority: Minor > Attachments: 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.