DockYard R&D: Firefly Optimizes Your Elixir Compilation

A set of Russian nesting dolls getting smaller from left to right
Cynthia  Gandarilla

Marketing Manager

Cynthia Gandarilla

At ElixirConf 2022, we highlighted four of our newest R&D initiatives: LiveView Native, Beacon, Firefly, and DockYard Academy. You can read more about our other efforts to broaden the Elixir toolkit in our Beacon and LiveView Native blog posts. And learn how we’re helping grow the Elixir community in our DockYard Academy Q&A.

DockYard is committed to expanding the use cases for Elixir. We’ve invested thousands of hours invested in R&D to introduce new tools, bring new levels of efficiency, and widen the scope of what developers can do with Elixir.

Firefly (formerly known as Lumen), gives developers an alternative compiler to the BEAM. It allows developers to capitalize on Elixir’s inherent distributed systems capabilities and offers new levels of efficiency and speed for compiling Elixir applications.

What is Firefly?

Firefly is an alternative compiler to BEAM capable of rendering applications faster and more efficiently. Unlike BEAM it compiles applications ahead of time, allowing Firefly to perform optimizations BEAM can’t.

Notably, Firefly can make use of the WebAssembly System Interface (WASI), to target use cases where WebAssembly is already being used.

How does it benefit me?

Firefly benefits users in two main ways: efficiency and compilation size.

It can compile code more efficiently than the BEAM by stripping out dead code and compiling only what’s necessary for an application. Firefly can perform optimizations that BEAM can’t, leading to significantly faster compilation times.

By extension, the end result is a significantly smaller digital footprint that more closely aligns with what’s needed to run on many IoT devices.

Until recently, Nerves was the primary option for creating IoT applications in Elixir. But Nerves applications often end up too large to be used for many smaller IoT devices. Firefly will fill that gap. By compiling down to less than 1MB, Firefly will make it possible to put Elixir’s distributed system benefits to use for more IoT devices than ever before.

Finally, Firefly gives Elixir teams another option to remain in the Elixir ecosystem. With it, they won’t be forced to branch out into other languages to solve common problems and develop applications for specific use cases.

Who is it for?

Firefly is for Elixir developers looking for an efficient, fast alternative to the BEAM. Capable of compiling code down to small digital footprints, Firefly is an ideal tool for developers exploring IoT, or similarly resource-constrained environment use cases for Elixir applications.

What does it do?

Firefly compiles Elixir applications faster and more efficiently than the BEAM can, and introduces WASI targeting to run applications in resource-constrained environments.

Because it can target WASI, Firefly is able to compile Elixir applications without having to run through the Erlang Virtual Machine. It can strip out unused code to reduce size, improve compilation speed, and perform optimizations the Erland VM can’t.

And, as an ahead-of-time compiler, Firefly offers far greater speed and efficiency as a compiler than BEAM can.


Firefly not only gives Elixir developers an alternative to the BEAM for compiling applications, it opens new avenues to take advantage of Elixir’s distributed system benefits in resource-constrained environments.

With it, we’re growing the number and types of ways Elixir can be used as part of a larger tech stack, and once again eliminating the need to look outside the ecosystem for a solution to common problems.

Read up on more of our R&D work—including two more of our newest projects, Beacon and LiveView Native—on our blog, and keep up with the latest from the DockYard team by following us on Twitter and LinkedIn and subscribing to our newsletter.


Stay in the Know

Get the latest news and insights on Elixir, Phoenix, machine learning, product strategy, and more—delivered straight to your inbox.

Narwin holding a press release sheet while opening the DockYard brand kit box