Is it possible to make PyPy smaller?

I have a small command-line tool, written in Python, which I would like to give to a few people to use on their own machines. For performance reasons, I would like to distribute the tool with PyPy rather than CPython. For this particular tool, PyPy runs 60 times faster than CPython (and only 3 times slower than a less-capable C++ implementation). My concern with distributing PyPy to end-users is size: Python27.dll is 2.3MB while libpypy-c.dll is 41.9MB. Why is PyPy so much bigger than CPython? Is it possible to build a version of PyPy which is closer to CPython in size?

On Thu, 30 Jun 2016, Paul Baker wrote:
It may be very well possible with some compilation flags juggling, but building PyPy on Windows is not a walk in the park, so you really need to consider whether you want to get into it or not... What is your main concern, however? I would assume, that this DLL compresses really well with something like 7z / ultra, does it not? If it's the unpacked size that bothers you, you could, for instance, treat the DLL with UPX. -- Sincerely yours, Yury V. Zaytsev

Hi, On 30 June 2016 at 13:15, Yury V. Zaytsev <yury@shurup.com> wrote:
Thanks Yury for the answer. Yes, technically, the PyPy DLL is much larger than CPython's for a combination of reasons, each adding their own factor---even if, like you should, you compare libpypy-c.dll with the total size of python27.dll and all other .pyd files. In the end the libpypy-c.dll is probably more compressible than CPython's, so by compressing it you regain some of that factor. You don't regain all of it by far, though. You don't get a complex JIT compiler for free, for example. A bientôt, Armin.

On Thu, 30 Jun 2016, Armin Rigo wrote:
So, just out of curiosity, with a very old and outdated version of upx: File size Ratio Format Name -------------------- ------ ----------- ----------- 40565248 -> 7155712 17.64% win32/pe libpypy-c.dll That's 7M! Surely the latest version must be able to do a bit better. Now, the complete PyPy distribution, compressed with a very old and outdated xz --best is around 14M, and it's even a bit smaller if you compress the libraries with upx first. I think that's a fair price to pay for a powerful JIT, isn't it? On top of that, as I said, one might have some luck playing with the compiler flags, but I think it's hardly worth it. -- Sincerely yours, Yury V. Zaytsev

On Thu, 30 Jun 2016, Paul Baker wrote:
It may be very well possible with some compilation flags juggling, but building PyPy on Windows is not a walk in the park, so you really need to consider whether you want to get into it or not... What is your main concern, however? I would assume, that this DLL compresses really well with something like 7z / ultra, does it not? If it's the unpacked size that bothers you, you could, for instance, treat the DLL with UPX. -- Sincerely yours, Yury V. Zaytsev

Hi, On 30 June 2016 at 13:15, Yury V. Zaytsev <yury@shurup.com> wrote:
Thanks Yury for the answer. Yes, technically, the PyPy DLL is much larger than CPython's for a combination of reasons, each adding their own factor---even if, like you should, you compare libpypy-c.dll with the total size of python27.dll and all other .pyd files. In the end the libpypy-c.dll is probably more compressible than CPython's, so by compressing it you regain some of that factor. You don't regain all of it by far, though. You don't get a complex JIT compiler for free, for example. A bientôt, Armin.

On Thu, 30 Jun 2016, Armin Rigo wrote:
So, just out of curiosity, with a very old and outdated version of upx: File size Ratio Format Name -------------------- ------ ----------- ----------- 40565248 -> 7155712 17.64% win32/pe libpypy-c.dll That's 7M! Surely the latest version must be able to do a bit better. Now, the complete PyPy distribution, compressed with a very old and outdated xz --best is around 14M, and it's even a bit smaller if you compress the libraries with upx first. I think that's a fair price to pay for a powerful JIT, isn't it? On top of that, as I said, one might have some luck playing with the compiler flags, but I think it's hardly worth it. -- Sincerely yours, Yury V. Zaytsev
participants (3)
-
Armin Rigo
-
Paul Baker
-
Yury V. Zaytsev