need for speed

Steven D'Aprano steve at REMOVETHIScyber.com.au
Mon Aug 1 18:47:39 CEST 2005


On Mon, 01 Aug 2005 02:28:36 -0700, borges2003xx at yahoo.it wrote:

> hi everyone
> can someone suggest me where find a lot programming tricks for
> achieving the top speed in python?

There is only one programming trick you need to know about making code run
fast.

Never even waste one second on optimising code before it is working,
or before you have tested it and profiled it and know (1) that it IS slow;
and (2) WHERE it is slow.

Why would you waste your valuable time making bugs run faster? Why waste
time and effort to speed up something that is already fast enough?

In other words: Make your code work. Make it work right. Then, and only
then, make it run fast -- and only if it isn't already fast.

Now that you have written your code, and you have made it work right,
please tell us what the code is, and the results of profiling the code,
and we will help you speed it up.



-- 
Steven



More information about the Python-list mailing list