frozenset question
Delaney, Timothy (Tim)
tdelaney at avaya.com
Wed Jul 6 19:45:18 EDT 2005
Steven D'Aprano wrote:
> If, over a thousand runs of the program, you save a millisecond of
> time in total, but it costs you two seconds to type the comment in
> the code explaining why you used frozenset instead of the more
> natural set, then your "optimization" is counter-productive. Even
> just considering the question is a waste of valuable developer time!
> THAT is the lesson of premature optimization: don't even THINK about
> optimizing code until you have it WORKING and you have MEASURED that
> it is too slow.
Tell me about it. I've had to strongly argue against premature
optimisation in my current project. I said "make it work and we'll make
it fast at the end".
Well, I made my part work. Then I spent less than a week optimising and
made it over 1000 times faster, without obfuscating it. Meanwhile other
parts still don't work, but contain lots of premature optimisations that
combined have taken well over a week to put into place.
Tim Delaney
More information about the Python-list
mailing list