Popcorn lets you run Elixir code in the browser via WebAssembly. It builds on top of AtomVM, a tiny Erlang VM. It’s early stages and breaks sometimes, but you can run Elixir code and even Elixir and Erlang compilers right from the browser.
We created some cool examples too - check them out at popcorn.swmansion.com, and the repo is available at
Great, how much slower, would the reduce latency make up for the loss of performance.
When I talk about regular, then I mean standard release. We tend to run the VM on servers, this as I understand would allow us to run our code on the client, in this case the browser.
No, it’s quite the opposite The goal is to run Elixir code on the client side. It would enable features like IEx or HexDocs examples running in the browser, but also local-first applications in Elixir. We aim to provide as many BEAM features as we can, if they make sense in that context, and good enough performance for these use cases.
Hi. I asked about this at ElixirConf, but my question wasn’t clear. I’m referring to something like this: GitHub - cocoa-xu/nif_call: Call Erlang/Elixir functions from NIF.. Could Atom be embedded as a library to have an Elixir runtime inside C, like the embedded Python interpreter? If so, would calling simple Elixir code be faster? Right now, using a NIF with an Elixir callback is complex. Maybe embedding AtomVM in a NIF would offer better performance.
Okay, I got it now, thanks for clarifying I think it should be possible to embed AtomVM as a NIF, but I’m not sure if it’s worth the effort. You would either need to effectively start the AtomVM just to execute a particular function, or have one running and communicate with it. Maybe the second way would be a bit faster than sending a message to the BEAM, but way more complex. Another problem is that the function wouldn’t have access to anything you already have running on the BEAM, and execution on AtomVM would be itself slower than on the BEAM.
But I can see the potential to use AtomVM for small, frequently executed scripts, as it seems to start faster than the BEAM.
I know Popcorn’s focus is on running in the browser, but curious if you think non-browser WASM applications could (potentially) make sense for Popcorn.
This is in our backlog, but I’m unsure how hard it is. We’d need to make AtomVM compatible with WASI, which is the way to run WebAssembly on the server. The challenge is basically that WASI is quite limited in terms of which POSIX features you can use.
But I’d love to see that happen, too! From what I read, it would unlock some cool projects like Wordpress in Elixir