[BangPypers] parsing xml
noufal at gmail.com
Fri Jul 29 08:01:39 CEST 2011
Venkatraman S <venkat83 at gmail.com> writes:
> Well, i have clearly mentioned my assumptions - i.e, when you treat
> the XML as a 'string' and do not want to retrieve anything else in a
> 'structured manner'.
If the data is structured, it makes sense to exploit that structure and
use a proper solution.
> I am a speed-maniac and crave for speed; so if the assumption is
> valid, i can vouch for the fact that regexp would be faster and neater
> solution. I have done some speed experiments in past on this (results
> of which i do not have handy), and i found this.
Premature optimisation is the root of all evil.
I find it highly unlikely that for a large program sufferring from low
performance, replacing an XML parser with a regexp based parser will
significantly improve peformance.
Use the right tool for the job and then if the performance is slow,
profile the program. If you then find that it's the XML parsing that's
the main bottleneck, switch to a different one or a C (or assembly )
based implementation. If it's *still* not fast enough, try moving to
regexps and then measure how much speed you get out of introducing so
much brittleness and fragility into your program.
Referring to a book: I read part of it all the way through. -- Samuel Goldwyn
More information about the BangPypers