[BangPypers] parsing xml
noufal at gmail.com
Fri Jul 29 08:50:27 CEST 2011
Venkatraman S <venkat83 at gmail.com> writes:
> On Fri, Jul 29, 2011 at 11:31 AM, Noufal Ibrahim <noufal at gmail.com> wrote:
>> > 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 belong to a different school. I think about performance right from the
> design dashboards for i think, be it a simple webapp or a financial
> application, the choice of your design patterns and techstack goes a long
> way in a good customer experience. Bulk of my thoughts are reflected in here
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.
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.
I end up messing with the former only when I've exhausted all other
avenues and *really* need that last drop of juice. This is usually
common in games and stuff like that with continous involved user
interaction rather than in webapps where it's a little more spaced out.
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.
That's the point I'm trying to make.
If I could drop dead right now, I'd be the happiest man alive! -- Samuel Goldwyn
More information about the BangPypers