Python: Is there a performance difference between `dist` and `sdist`?
performance, python, setuptools
Solution
If you have a pure Python code, the difference in time deploying will be slim. Note that there is no difference in performance between `.py` and `.pyc`, except that the latter will be read slightly faster the first time. The so called optimised `.pyo` only strip the asserts, and optionally, get rid of the docstrings, so they are not very much optimised.
The big difference comes when you have C files. sdist will include them if properly referenced, but the user will need a working and appropiate compiler, Python header files, and so on. Also, you will have to take the time to build them on every client. The same distribution will be valid for any platform you deploy in.
On the other hand, bdist compiles the code once. Installing in the client is immediate, as they don't need to build anything, and easier as they don't require a compiler installed. The downside is that you have to build for that platform. Setuptools is capable of doing cross-compilation, provided you have installed and configured the right tools.
Problem
Python `setuptools` can create a source distribution: ``` python setup.py sdist # create a source distribution (tarball, zip file, etc.) ``` Or a binary distribution: ``` python setup.py bdist # create a built (binary) distribution ``` As far as I understand, there should not be any performance difference: - `bdist` installs the already-compiled `.pyc` files from the binary package. - `sdist` compiles the `.py` files to `.pyc` files, and installs them. When executed it should not matter how were the `.pyc` files compiled - they should have the same performance. Is there any performance difference between `dist` and `sdist` python packages?