[XOM-interest] XOMTestCase.assertEquals() too slow

Wolfgang Hoschek wolfgang.hoschek at mac.com
Fri Jan 26 02:49:55 EST 2007


On Jan 25, 2007, at 9:44 PM, Wolfgang Hoschek wrote:

>> It's not clear why XOMTestCase.assertEquals() should be orders of
>> magnitude slower than parsing or serialization. All of these should
>> clearly be O(N) overall.
>
> Turns out the comparison is implemented with an O(N^2) algorithm.

Since this is all code related to normalization I looked at how  
nux.xom.pool.XOMUtil.Normalizer behaves for wide trees (e.g. database  
dump style documents, indented). Turns out it's also O(N^2) in this  
case, but it was straightforward to change it to O(N).

Wolfgang.





More information about the XOM-interest mailing list