[BangPypers] parsing xml

Venkatraman S venkat83 at gmail.com
Fri Jul 29 09:39:34 CEST 2011

n Fri, Jul 29, 2011 at 12:20 PM, Noufal Ibrahim <noufal at gmail.com> wrote:

> I agree and I try my best to do the same thing. However, I differentiate
> between micro optimsations like rewriting parts in C and XML and top
> level optimisations like good design and the right data structures.
Using regexp is micro optimization?

> The former, I don't do because I get bogged down by the details and end
> up delivering something that's super fast *really* late. The latter, I
> do because otherwise, the application is unusable and a bad
> experience. Also, micro optimising (e.g. replacing DOM parsing with
> regexps to extract stuff out of an XML message) makes code more brittle
> which is also a no win for the customer.

IMHO, regexps are much more powerful and fault tolerant than XML parsing.
XMLs are brittle.

> If performance is *this* important to you, why don't you code your
> entire application in assembly hand crafting it for a certain processor,
> amount of memory and hard disk platter speed? Why use Python at all? The
> reason is because Python is "fast enough" for most things. You can get
> better performance moving to lower level routines but it's often not
> necessary and the costs it entails are usually not worth it. Better a
> fast enough stable app than a super fast one that occasionally segfaults
> and loses data.

Not sure how this point is relevant; the amount of performance you need is
dependant on the nature of application you develop.

For eg, see this presentation for how simple hacks like 'compressing' dom
'getters/setters' can affect browser performance.
At the same time, look at this TED talk wherein trading applications spend
billions of $ for milliseconds performance gains

For a webapp, XML parsing is very important factor that the developer *must*
consider while designing.

More information about the BangPypers mailing list