Idiom for running compiled python scripts?

Sherm Pendley spamtrap at dot-app.org
Sun Mar 25 06:26:01 EDT 2007


Mark <mark at mailinator.com> writes:

> Of course I realise the modern mantra that "premature optimisation is
> the root of all evil" but I don't subscribe to it.

Note the first word - premature. It's an important distinction, and you've
entirely missed it.

Optimization is premature if you haven't yet ensured that your program is
correct. Worry about getting it right first - and that includes selecting
the appropriate algorithms.

Optimization is premature if you haven't yet profiled your code to identify
precisely *what* code is a bottleneck.

Once you've identified your code's bottleneck(s), and verified that your
algorithm(s) is (are) ideal - then it's time to optimize the implementation
of the algorithm(s), if you still need to. (Most of the time you won't; in
my experience, bottlenecks are the result of badly-chosen algorithms in at
least nine out of ten cases.)

> Programmers have been
> "encouraged" to not give a toss about efficiency

Nonsense. Efficiency is about making the best use of limited resources, and
in most cases the most limited resource is people. Saving $x in hardware
cost by spending $x*10 on programmer salary is not efficient.

> and the outcome is all
> too apparent - most software today looks and runs like a pile of crap.

Most software today is written by comparitive amateurs who use "clever" code
that tries to compensate for badly-chosen algorithms, who guess at where
bottlenecks "might" be instead of profiling their code to see exactly where
they *are*, and who scoff at Knuth's "mantra" because they've misunderstood
what he meant by both "premature" and "optimization".

In other words, premature optimization is quite often the reason why software
often looks and runs like a pile of crap.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net



More information about the Python-list mailing list