Is it possible to 'compile' a script?

Greg Ewing see_reply_address at something.invalid
Thu Oct 3 21:36:58 EDT 2002


solosnake wrote:

> Hello
> 
> Does Python offer the ability to 'compile' a script into a faster form?


How fast does it need to be? Have you actually tried
it and found it to be too slow for your application?
If not, I strongly suggest that you do so before
worrying about how to make it faster. There's a
good chance that it will be fast enough!

Note that Python already compiles scripts internally
to a bytecode before executing them, and does most
things that are reasonably practical to interpret
the bytecode as quickly as possible.

If it's really not fast enough, all is not lost --
you can re-code selected parts of your algorithm in
C and call them from Python. Selected by careful
profiling to find out what really needs to be sped
up, of course.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list