6 ms·
Our of curiosity, why not just compile cpython to webasm and call it a day by shimming in module loading? I'm sure it's for performance (or extensibility?), but
by foota 6y ago
Our of curiosity, why not just compile cpython to webasm and call it a day by shimming in module loading? I'm sure it's for performance (or extensibility?), but I'm curious where it really falls down.
- Doxin 6y agoThat totally does work, but in practice it makes the initial bundle download too big to really be workable for the average website.
- 6gvONxR4sf7o 6y agoWould the same be true of javascript? If chrome didn't come with V8 in it, would it be a lot for the average website?
- pansa2 6y agoOne way to find out would be to compile QuickJS [0] to WebAssembly. [0] https://bellard.org/quickjs/ https://bellard.org/quickjs/
- asaddhamani 6y agoSeems to be 945KB in WASM. http://numcalc.com/ http://numcalc.com/
- meredydd 6y agoThis is exactly what Pyodide (mentioned in the article) does, and it works great for some use cases. The problem is that downloading and wasm-compiling the entirety of CPython and all its native modules is big and slow. A colleague of mine collected and compared a few Python-in-the-browser implementations - including Skulpt and Pyodide - with code samples and a description of the trade-offs. You might find the write-up interesting: https://anvil.works/blog/python-in-the-browser-talk https://anvil.works/blog/python-in-the-browser-talk
- throwaway894345 6y agoNot to mention any native module you might want to use from Pypi must also be compiled for WASM which is probably not very easy to come by.