Lists Home |
Date Index |
Martin Soukup writes:
> I did the same in Java, and it is well over 1000 times slower. I
> agree with John that performance isn't everything, but 1000 times
> slower using the same technology is, IMO, completely unreasonable.
The biggest mistake people make designing XML processing systems is
not distinguishing between what happens in the loop and what happens
outside the loop.
Optimizations inside the parsing/processing loop can give enormous
payoffs -- for example, if you have a method that's invoked for every
element, every text chunk, or even every character, it's an excellent
candidate for optimization. On the other hand, optimizing a method
that's invoked only once per document (unless your system handles
thousands of small documents per minute) or once per session is
generally a waste.
For example, let's say that a method currently runs in 10
microseconds, and through brilliant refactoring, you make it 1000
times faster. If that method is invoked once for every character in a
1GB document, then you've just shaved 10 seconds off execution time --
if you managed that with only a day's work, you deserve a productivity
aware. If, on the other hand, that method is invoked once during the
session, you've shaved about 0.00001 seconds off execution time -- if
you spent a whole day doing that, you deserve something more along the
lines of a bozo award.
Using an exception to terminate parsing falls into the latter category
unless, as I mentioned, you have an application that processes
thousands of XML documents every minute.
All the best,
David Megginson, email@example.com, http://www.megginson.com/