On Wed, 20 Aug 2014 13:34:05 -0700 (PDT) mujahedsyed <[email protected]> wrote:
> Hi Marc, > > Here is the sample project: > https://github.com/mujahedsyed/xml-security.git due to data > protection I had to create a sample xml that is little bit complex, > but this still simulates the issue. The processing instruction tag > that indicates the qname to be encrypted is located on line 6987 of > https://github.com/mujahedsyed/xml-security/blob/master/src/main/resources/data-file.xml > the file size is 326KB when you run this sample app you will notice > that decryption time is around 38 secs. If you remove the encrypt PI > tag from line 6987 and place it on line 5 than decryption time is > around 6 secs! > > My investigation suggests that the most time consuming operation is > next method as previously mention - i have a doubt if this can be > optimized. Thanks for the sample. I think the behavior of the framework does not match with your expectations. If I'm not wrong you expect to have the immediate element after the PI to be encrypted, nothing more and nothing less, right? Unfortunately, that's not the way how the StAX implementation works. We don't have anything else as the QName's to identify the elements that should be encrypted. So what now happens is the following: If you place the PI on the <color_swatch> element it instructs the framework to encrypt _all_ elements that matches that QName. For the sample document "data-file.xml" that resulted in about 2775 encrypted <color_swatch> elements. This also explains why it is much faster when you place the PI on the <product> element because there are much less of them in the doc. Apart from that it is known/expected that the current StAX impl. performs not very well compared to the DOM impl. for small documents or a lot small encrypted parts. The overhead is simply to big for such documents. The advantage over the DOM approach is mainly the smaller memory footprint. Marc > > Please let me know your valuable suggestions. Thanks. > > Regards, > Mujahed > > > > -- > View this message in context: > http://apache-xml-project.6118.n7.nabble.com/Performance-Testing-tp41389p41396.html > Sent from the Apache XML - Security - Dev mailing list archive at > Nabble.com.
