Optimized Python side
stefnotch opened this issue · 1 comments
stefnotch commented
Future optimizations would be knowing all the different Python functions that can get called and having "callbacks" for them instead of using pyodide.runPython
. Basically, executing actual functions instead of eval-ing code.
Relevant
- https://github.com/iodide-project/pyodide/blob/1eb13f2629bed5405e3570e314086de0eb94c468/src/runpython.c#L12
- https://github.com/iodide-project/pyodide/blob/76efcaccf7cb0f478ed1f17fd36cd79f3370980e/src/python2js.c#L17
- https://github.com/iodide-project/pyodide/blob/9afc7a1617c1c127590418e8cdbf2ec9831d7c50/src/pyodide.py#L25
- https://github.com/iodide-project/pyodide/blob/76efcaccf7cb0f478ed1f17fd36cd79f3370980e/src/pyproxy.c#L97
- Directly calling things like
Module.hiwire_new_value
andModule.__pyproxy_apply
- https://github.com/iodide-project/pyodide/blob/fc5495ffdb54a11fd588dc60ba6b8777f90c3724/src/python2js_buffer.c#L458
Another potential optimization would be using bytes and buffer objects for larger values, as those don't have to be copied in memory.
Also, keep track of other projects like