http://www.perlmonks.org?node_id=962764


in reply to The Rules of Optimization Club

I hope you realize how ironic this sounds in this forum. my typical usage here is: click on a thread, than switch tab to a different forum/rss feed/whatever, read 2 or 3 articles, then switch back to perlmonks where the thread has finished loading ;-)

first: I think everyone would agree that optimizing without having a clue is a waste of time. playing around with Benchmark and Devel::NYTProf can be really enlightening.
if you don't have a clue about algorithms and complexity you still can write programs that do what you want, that are well written in terms of maintainability and "fast enough".

but: if nobody ever cared about writing highly optimized perl modules, nobody would want to write applications and websites with it.

I'm actually sick of people warning about premature optimization over and over. in the last weeks I have been optimizing my forum software which has been running live for over three years. I did many different optimizations, and by logging the different request times and viewing them in munin graphs I could clearly see what kind of optimizations were more successful and which less.
I can estimate that some optimizations will be only worth if the website had more traffic. But that's no reason for not doing it. It's a software that I want to call "scalable".
I was talking about some of my thoughts in an IRC channel, and one person said to me that I was doing premature optimization. wtf?

so, yes: measure before or during optimization. if you are experienced though, often you don't need to measure beforehand.
but stop warning people about optimization in general.