Skip to content
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

ESM Syntax and usage of Pyodide on the server side #684

Closed
denjucks opened this issue Jun 10, 2020 · 2 comments
Closed

ESM Syntax and usage of Pyodide on the server side #684

denjucks opened this issue Jun 10, 2020 · 2 comments

Comments

@denjucks
Copy link

I am interested in this project, and interested in understanding it a bit further to see if it is possible to use it on the server side. I want to see if this project can be used with the Deno runtime, which is similar to node with some additional features and APIs, and built in WASM support. Before trying to port it over, I am wonder what the viability is of a port:

  • Speed: What is the speed differential roughly between executing python natively versus wasm?
  • ESM Syntax: Is it possible to import pyodide and the underlying js modules using ESM syntax, as this is the syntax used in Deno.

If its possible to run on the server side with good speed, I am wondering what the process would be to convert everything over at a high level. Would I need to recompiler the binaries, or just update the JS code?

@rth
Copy link
Member

rth commented Jun 10, 2020

Speed: What is the speed differential roughly between executing python natively versus wasm?

Near native or a few times slower for Python code extensively using C-extensions (e.g. numpy etc), and up to 10x slower for some pure python code see "How fast is it?" section in https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/

ESM Syntax: Is it possible to import pyodide and the underlying js modules using ESM syntax, as this is the syntax used in Deno.
Would I need to recompiler the binaries, or just update the JS code?

There was an attempt to add NodeJS support in #183 if that helps.

I would imagine updating the JS code including in emscripten (see emscripten-core/emscripten#5828), then recompiling, but not fully sure. Looking at https://github.com/emscripten-core/emscripten issues it doesn't look like anyone tried to use Deno with emscripten before so it's a bit of an uncharted territory.

@denjucks
Copy link
Author

Apologies for the late response! Thanks for the info. So it looks like it is possible, and for some libraries this can be pretty fast. I'm most interested in seeing if pandas can be ported over, as there is a similar library for node called DataForge but in some of my tests its about 10x slower than Pandas, so if the pyodide Pandas is even 2-3x slower then it would still be a substantial gain in speed. I'll play around with the code a bit and check out what others have done for Node to see the viability of a port and how difficult it would be to port. Thanks for all the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants