need for speed

B

borges2003xx

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

Steven D'Aprano

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.
 
M

Michael Rybak

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

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

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

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

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


Is there a way of profiling other than manual (debug output with
measurements and all)? Some tools? And is there some kind of plugin
for native Python's IDLE to trace scripts? I'm a bit tired of getting
all info from debug output and exceptions

SDA> --
SDA> Steven
 
D

Dennis Lee Bieber

Is there a way of profiling other than manual (debug output with

Chapter 10 of the Python Library Reference... You have looked at
that document, haven't you?
measurements and all)? Some tools? And is there some kind of plugin
for native Python's IDLE to trace scripts? I'm a bit tired of getting

Have you read Chapter 9?

BTW: if you are working on M$ Windows, you might want to
consider installing the ActiveState release -- PythonWin might be nicer
than IDLE (and has the referenced manuals formatted as Windows help
files).

--
 
M

Michael Rybak

sorry for emailing privately, pressed the wrong "reply" button

DLB> On Mon, 1 Aug 2005 20:14:51 +0300, Michael Rybak <[email protected]>
DLB> declaimed the following in comp.lang.python:


DLB> Chapter 10 of the Python Library Reference... You have looked at
DLB> that document, haven't you?
Already am, yes!

DLB> Have you read Chapter 9?
ok, I'm looking through. A bit tough for me I think, I can live with
debug outputs :) Well I'm too much used to M$ V$ / Borland Delphi
interfaces to switch to almost-asm-like debugging.

DLB> BTW: if you are working on M$ Windows,
only on that
DLB> you might want to consider installing the ActiveState release
I tried, and the installer gives me that stupid Internal Error 2229:
Control, SELECT 'Control', 'Type', 'X', 'Y', [..snip..], 'Dialog' = ?
And I forgot the OK button.

DLB> -- PythonWin might be nicer than IDLE (and has the referenced
DLB> manuals formatted as Windows help files).
I am using a *.chm file containing all online documentation available
from python.org



DLB> --
DLB> > ============================================================== <
DLB> > (e-mail address removed) | Wulfraed Dennis Lee Bieber KD6MOG <
DLB> > (e-mail address removed) | Bestiaria Support Staff <
DLB> > ============================================================== <
DLB> > Home Page: <http://www.dm.net/~wulfraed/> <
DLB> > Overflow Page: <http://wlfraed.home.netcom.com/> <
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,311
Members
47,981
Latest member
satome

Latest Threads

Top