Rust? #16
Replies: 5 comments 1 reply
-
@meganindya -- this is an excerpt from a friend who is well versed in building scalable systems (for FB, Twitter, and Pintrest). Maybe we can take this approach instead? I for one would love to use Python. |
Beta Was this translation helpful? Give feedback.
-
During initial discussions about the architecture this was one of the reasons I made the argument to entirely separate out the core; I thought the frontend application client should communicate with the core using a REST-like API. JavaScript was invented for a specific purpose and with time its use grew unprecedentedly and we're here now with uncountable npm packages. This growth was mostly accelerated by node. Nevertheless, it is not a performance oriented language. That's why Dart came to my mind as it compiles to (faster) JavaScript or can be natively executed. But, WASM with C++ or Rust was the first thing I thought of. I did a bit of research but came to the conclusion that it is not there yet; probably, as of now, it'll be too much effort on our part as well. But, I'd love to explore the possibility. I think it is imperative for us to extract as much juice as possible. Sure, we can optimize our algorithms multi-fold but there's no escaping from the fact that JavaScript is slow. And it is single threaded. WASM does add the benefit of multiple language support on the browser natively, which is a a big plus. But, I guess the question still remains: are there enough resources currently for us to land this project on WASM? There's browser support issue as well. |
Beta Was this translation helpful? Give feedback.
-
I found these: Looks promising. |
Beta Was this translation helpful? Give feedback.
-
I did some reading and here are my observations:
I don't have enough information pertaining to the performance gain with using Python in a WASM compiled interpreter, given that it adds the bulk of carrying the interpreter with the application. With the languages mentioned in point 6, we'd actually get the benefit of WASM without having to carry any additional weight. |
Beta Was this translation helpful? Give feedback.
-
And this: https://web.mit.edu/music21/ |
Beta Was this translation helpful? Give feedback.
-
hmm could you do python --> wasm?
I don't know anything about wasm
ok so it might be too early
but there is https://github.com/RustPython/RustPython
so because compiling to wasm is an official target, one day you could run your python code in RustPython and generate WASM
should be an exciting decade for WASM too
a much needed web renaissance
[ at work we run code on every continent, to make serving your Turtle Art pins fast, so ideally at some point we want to generate WASM out of C++... and run that as close to users as possible ]
Python directly running your browser:
https://rustpython.github.io/demo/
[ early days, but promising ]
i could imagine the core algorithms of MB rely purely on the most fundamental parts of python (lists, dicts and that's it)
so I can access JS libraries?
so maybe that would be libmusicblocks-core which could be then imported and wrapped
yeah, but would the other way around be nicer?
from JS import the MB "virtual machine"
actually which ones are the juicy bits
the MB virt machine
I'd like to do everything in Python except the view
or the drawing
the view is the drawing and the webaudio
if the MB virt machine was in python, that'd mean nice unit tests plus easy to test in the console plus just generally nicer
is your code something like 30% drawing, 20% controller logic (wiring up view to events) and 50% the virt machine?
maybe even more VM than that
interesting, than having a toolchain that outputs reusable WASM might pay off nicely [ specially because of developer happiness -- you can crank out python without fighting the browser devel env ]
*then having
ok so not too crazy, this project is doing it:
https://github.com/iodide-project/pyodide
if they got these packages properly running as WASM:
NumPy, Pandas, Matplotlib, parts of SciPy, and NetworkX
getting the MB virt machine shouldn't be that much work...
Beta Was this translation helpful? Give feedback.
All reactions