Are there any benefits of a shared build python, compared to a static build python?

Barry barry at barrys-emacs.org
Wed Jul 20 13:50:07 EDT 2022



> On 20 Jul 2022, at 18:09, Tianhe <ptq008 at gmail.com> wrote:
> 
> Python by default builds the library `libpythonMAJOR.MINOR.a` and
> statically links it into the interpreter. Also it has an `--enable-shared`,
> (https://docs.python.org/3/using/configure.html#cmdoption-enable-shared)
> flag, which will build a shared library `libpythonMAJOR.MINOR.so.1.0`, and
> dynamically link it to the interpreter.
> 
> Are there any benefits of a shared build python, compared to a static build
> python? Is there any performance difference?

What appears to be important is being able to do link time optimisation of python code.
I think Debian starting doing this first and other distro followed after seeing the big
performance improvement Debian got.

Barry

> 
> I found a related question on SO and is it like he said (
> https://stackoverflow.com/a/73035776/5983841), shared built vs statically
> built python only affects the "Embedding Python in Another Application"
> scenario ?
> 
> --
> 
> Regards,
> 
> Micky
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list