Reputation: 2651
I am working on a script someone created for modifying 3D digital models that was written in Python code. The original author compiles the file into a Windows executable before distributing it. I'm guessing he uses py2exe
or some similar tool.
My question is, is there any speed benefit in doing so? The script is very slow, and I'm hoping for better performance after compiling the script. Thanks.
Upvotes: 0
Views: 2777
Reputation: 126777
No. py2exe
and similar tools just create a bundle including the Python interpreter, the bytecode of your Python sources and their dependencies. It's just a deploy convenience, there's no speed advantage (besides skipping the initial parsing of the .py
files; in this respect, it's like running your code the second time when the .pyc
files are already created).
For "out of the box" performance improvement you can try running your script with PyPy instead of CPython - for "all interpreted" (=> no numpy & co.) numerical Python code I saw very often 20x speedups.
Upvotes: 3