-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mypycropip? #24
Comments
Thanks for the proposal! There is a somewhat related ongoing work to py-compile (convert .py files to .pyc) in pyodide/pyodide#3253 and pyodide/pyodide#3166 which should also result in significantly faster loading of the interpreter and micropip. About mypyc I'm not sure. mypyc makes sense for functions that are compute bound, but it feels to me we are doing very little computation in micropip: most of it is I/O bound currently I would say (either via the network for the in memory FS), but maybe I'm wrong. If there are compute bottlenecks there, it might be worthwhile optimizing them first in pure Python. Some of the loading overhead was due to .py -> .pyc compilation and that would be removed when shipping .pyc. Though yes, if we go forward with shipping .pyc files (and lose source readability anyway), why not go further and turn the source through some actual compilers (mypyc or Cython) is indeed an interesting question. |
Welp, it all starts with benchmarking and profiling: there are a solid number of loops where strings are compared, which seems to be a place where
i think once most folk see issues inside the ur-plumbing (package managers, stdlib), they kinda zone out anyway. But definitely a tradeoff... again it comes down to all those competing dimensions of file size, browser/js parsing, interpreter overhead, etc. of |
Yes, good idea! pyinstaller actually indeed works fine, from pyinstrument import Profiler
import pyodide_js
p = Profiler()
with p:
await pyodide_js.loadPackage('micropip')
import micropip
p.print() outputs,
|
savage 🦖 |
I believe the newer version of packaging have a lower footprint in terms of that profiling. Could you test that? |
Elevator pitch
Use
mypyc
during the build ofmicropip
, offermicropip.*emscripten.*.whl
on PyPI.Motivation
It's theoretically a very small packaging change to add
mypyc
.This would convert the work and extra bytes (and sometimes surprisingly non-trivial runtime overhead) of type hints into compiled C code, add more robust (and efficient) runtime type checks on functions.
Design considerations
.whl
sizenone-any.whl
to keep the lightweight posturejupyterlite
'spiplite
might be left outThe text was updated successfully, but these errors were encountered: