HigherOrderCO / HVM

A massively parallel, optimal functional runtime in Rust
https://higherorderco.com
Apache License 2.0
10.42k stars 393 forks source link

If compiling Python is possible then what about Javascript ? #288

Open dejang opened 3 months ago

dejang commented 3 months ago

I stumbled upon this from a hackernews link and was immediately intrigued by the project. Being a Javascript developer for almost 2 decades and also a Rust fan I immediately thought about supporting Javascript as well.

Using Javascript on the backend is no longer an exotic solution. Javascript is also being heavily used in mobile applications. While I don't think compiling Javascript to run on HVM and somehow running HVM in the browser is feasible as parallelism cannot happen, to my knowledge, outside of WebWorkers, I do think that there is an opportunity to provide a fully parallel Javascript runtime solution similar NodeJS but based on HVM. This could enhance existing cloud solutions, like AWS Lambda, to unlock massive speeds when running Javascript code.

Similarly, some mobile apps spawn v8/JSCore processes in order to run critical features written in Javascript in the native environment. These solutions are often crippled by the single threaded nature of Javascript. In the mobile environment, a Javascript runtime based on HVM could prove to be an exciting alternative to v8/JSCore.

Looking forward to hearing your thoughts about this and if you think compiling Javascript to run in HVM is possible I'd like to offer my help and any knowledge I have to see this becoming a reality.

developedby commented 3 months ago

It definitely is. We actually built an experimental compiler from both javascript and python to HVM1 some time ago, sharing the same intermediate representation. Finding efficient ways to do it and handling all of each languages weird quirks is not easy though.

But this is definitely something we want to explore more in the future

dejang commented 3 months ago

I would happily contribute to such a project! And the fact that there is already a starting point is even better. I think I know the Javascript language well enough to understand most, if not all, its quirks.

Do you think you'll release the experimental compiler in the nearby future to allow external contributions ? I believe the feedback loop could also enhance the improvement of HVM.