Python: Is there a performance difference between `dist` and `sdist`?

Adam Matan

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?

Davidmh

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why is there a difference between LongStream reduce and sum performance?

Is there a performance difference between Numpy and Pandas?

What's the difference between dist-packages and site-packages?

What is the difference between an 'sdist' .tar.gz distribution and an python egg?

Java - Difference between dist and deploy folders

Measuring performance difference between Python and Java implementations?

Difference between lib and dist folders when packaging library using webpack?

Difference in performance between ngrx and ngxs?

Peculiar difference in MKL matrix multiplication performance between Fortran/Python/MATLAB

Performance difference between MRI Ruby and jRuby

What is the difference between make and make dist?

Performance difference between []+[] and [].join(',')+[].join(',')

Performance difference between SKShapeNode and SKSpriteNode

Difference between list and forward_list performance?

Difference between geodist() and dist() for Geo-Spacial Search

Improve performance of difference between elements block

Performance difference between `is` and `as` in LINQ

Performance difference between numpy.random and random.random in Python

Performance difference in query between cmd and workbench mysql

What is the difference between dist/**/* and dist?

Difference between this useReduxState hook and useSelector in terms of performance?

Difference between Update Manager and apt-get dist-upgrade

Performance difference between stdin and command line argument

Performance difference between drawBitmap and createScaledBitmap

The difference between dist functions in r

Performance difference between ?? and ==

Python dynamic programming performance difference

Multithreading not achieving performance difference Python

Performance difference between forEach and map