hn.today

Popcorn 1.0 Released: Moving from AtomVM to Full Erlang VM

swmansion.com4 points0 comments
Screenshot of Popcorn 1.0 Released: Moving from AtomVM to Full Erlang VM

Popcorn 1.0 is a stable release of the library for running Elixir applications in web browsers, and replaces AtomVM with the full OTP/BEAM runtime compiled to WebAssembly. AtomVM was small and quick to start, but its partial OTP support meant the team had to patch Elixir’s standard library and continually address compatibility gaps. Maintaining those changes diverted effort from Popcorn itself, while complete compatibility was unrealistic for a runtime designed around embedded-system constraints. A BEAM-to-Wasm experiment proved viable with minimal OTP C-code changes. The resulting runtime is larger and slower to boot than AtomVM: its Wasm binary is about 730 KB, with roughly 2.5 MB of standard-library files, compared with AtomVM’s roughly 250 KB compressed size and 80 ms startup. In return, BEAM starts in about 200 ms and ran tested workloads 3.4 to 1,800 times faster; it also supplies features such as bitstrings, regex, full ETS, and protocols.

The migration also reshapes how Popcorn runs and communicates with the browser. Web Workers replace iframes to isolate failures and support multiple VM instances, while the API distinguishes programmer errors from expected errors and adds more OTP-like calls, casts, and message sending. Standard-library files are packaged in compressed archives, and a Fetch-based adapter lets Req make browser requests without direct JavaScript calls, subject to browser networking restrictions such as CORS. Applications needing cryptography can use a build that includes OpenSSL. Upgrades are described as mostly mechanical, and the new runtime should make updates for newer BEAM versions easier. Future work includes better tree-shaking, performance and size improvements, interactive documentation, and smoother Elixir-to-JavaScript integrations.

Read on swmansion.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Four Months of Zig

Four Months of Zig

After four months back with Zig, Anna Liberty built a small-network client library, a typing game, and an N-body simulator, while enjoying Zig’s straightforward development experience. The experience also exposed unfinished tooling, including a built-in fuzzer that did not work, and highlighted the value of local Zig meetups. (gracefulliberty.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.