Compiled bytecode

"Martin v. Löwis" martin at v.loewis.de
Wed Dec 29 19:04:27 EST 2004


LutherRevisited wrote:
> This may be a dumb question, but are there any practical advantages of
> compiling a python application to *.pyo, or *.pyc?  I haven't noticed any
> difference in the performance of text *.py or a bytecompiled file.

For a large application, the startup cost may be noticable, as it first
compiles all files to bytecode. So it is a good idea to keep the
bytecode files around.

As to what difference -O makes: in 2.4, it only
- sets __debug__ to be false, at compile time,
- removes assert statements
- removes __doc__ strings from the bytecode

Regards,
Martin



More information about the Python-list mailing list