On 2013-04-06, David Rees wrote:

> 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.

That's huge.

> 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?

Are we talking 2.0 here?  Really, we've got a user :-)

In that case this is not quite true.  DifferenceEvaluator is called for
each and every comparison and the implementation might base its decision
on the actual XPath.

One option may be to somehow copy XPathContext's state into the
Comparison and evaluate it lazily only when the XPath needs to be
constructed.  This would require creating new objects with a copy of
XPathContext's "path" member rather than building up the string.  In the
end that may cause similar pressure on the garbage collector but should
be faster than building up the string (and running replace on it).

Stefan

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Xmlunit-general mailing list
Xmlunit-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to