Go to content

Chris Keele - Match Specs: Fast Functional Filtering with Matcha

This talk explores a powerful but inaccessible feature of the BEAM VM, match specifications, through a library designed to make using them much more ergonomic from Elixir, Matcha. Match specifications allow you to do abnormally fast pattern matching, destructuring, and re-structuring of in-memory data. The BEAM VM compiles them to something close to the raw bytecode used to make pattern-matching function heads on dispatch performant, and you, too can tap directly into this pattern-matching engine for your own purposes! They are also recognized in erlang's tracing and ets APIs, letting you inspect the state of your runtime system and query your in-memory data stores with great specificity and efficiency. The only catch: they are kind of a chore to compose and use. Matcha lowers the barrier to entry, allowing you to write and execute them with clean Elixir code. The goal of the talk is the same as the goal of Matcha: to help place the power of match specifications in the hands of more Elixir developers!

August 30, 2022