3 ms·
Python is big in the sense that your wasm bundle with the CPython runtime and a bunch of the standard library are going to be several MB most likely. Just libpy
by VorpalWay 11mo ago
Python is big in the sense that your wasm bundle with the CPython runtime and a bunch of the standard library are going to be several MB most likely. Just libpython.so in my system is 8.7 MB for example. The standard library is an additional 56 MB.
Yes, you can compress and strip down unused parts, but it will still not be a fast loading page if you want to provide a reasonable coding experience for the user to write python in. And it will eat server bandwidth, not a big deal if it is just you self hosting for yourself, but if you want to make this a public service that does matter.
- mg 11mo ago8.6 MB - wow! There must be way more in there than just running Python code. I once implemented a small subset of PHP in PHP (just enough to run the code I wanted it to run) and it took me 320 lines of code. The file (gloriously named php.php) was less than 10k in size. Still, loading 8.7 MB is kinda ok. It takes about 2s on my pretty normal home connection. Indeed, https://pyodide.org/en/stable/console.html https://pyodide.org/en/stable/console.html loads a wasm that is 8.7 MB. It also loads "python_stdlib.zip" which is 2.42 MB. Maybe that is the whole standard lib in compressed form? I wonder why they publish a zip. Browsers natively support all kinds of nice compression. I guess there are leaner implementations than CPython? https://pyscript.net https://pyscript.net loads a file "mircopython.wasm" that is 434 KB.