quantum-sheet icon indicating copy to clipboard operation
quantum-sheet copied to clipboard

Optimized Python side

Open stefnotch opened this issue 5 years ago • 1 comments

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 and Module.__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

  • https://github.com/wapm-packages/python
  • https://github.com/Nuitka/Nuitka
  • https://github.com/RustPython/RustPython
  • https://github.com/pmp-p/micropython-ports-wasm
  • https://github.com/micropython/micropython/tree/master/ports/javascript
  • https://github.com/brython-dev/brython

stefnotch avatar Jun 20 '20 17:06 stefnotch

https://github.com/sagemathinc/zython

stefnotch avatar Oct 07 '22 07:10 stefnotch