Menu

#61 XPathContext.getXPath taking bulk of processing time

Java 2.x
closed-fixed
nobody
None
5
2014-12-29
2013-04-11
david rees
No

After running some profiling on my tests I've discovered that XMLUnit is taking the bulk of the time and XPathContext.getXPath is taking 58% of XMLUnit's time. I've attached a VirtualVM Profiler screenshot.

XPathContext.getXPath is called twice every time a comparison is done to add the xpath for the control and test value to the created Comparison. However, the xpath is only needed when the comparison fails or if match tracking is being done. Perhaps the Comparison should only be created if the compare fails or maybe the xpath should only be set when compare fails?

1 Attachments

Discussion

  • david rees

    david rees - 2013-04-11

    I've actually tracked it down to two things in the XPathContext.getXPath.
    The biggest is actually the "replace(SEP + SEP, SEP)". When I remove that my XMLUnit benchmarks go from 0.11 to 0.06. I haven't played with it enough yet to know enough why that line is there so I can replace it.

    I also took a crack at using dynamic programming to store the xpath expression in the Level objects. So its only computed once for each level. That took it from 0.06 to 0.04. That patch (with only basic testing so far), is attached.

     
  • Stefan Bodewig

    Stefan Bodewig - 2013-04-14
    • status: open --> pending-fixed
    • Group: Java_1.4 --> Java 2.x
     
  • Stefan Bodewig

    Stefan Bodewig - 2013-04-14

    patch committed as revision 528

     
  • Stefan Bodewig

    Stefan Bodewig - 2014-12-29
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.