Match Specs: Fast Functional Filtering with Matcha

Product information




Beginner, Intermediate, Advanced


Chris Keele has been active in Elixir since 2013, when he corrected a typo in the stdlib docs. Since then he has written “mix new” over 100 times, implemented defguard for v1.6.0, read 35,000 posts on the forums, volunteered at half-a-dozen Elixir conferences, and probably contributed more typos to the ecosystem than he has fixed.

He resides in North Carolina with his two cats, Rosencrantz and Guildenstern, in a house protected by a jerry-rigged Nerves smarthome system he spends more time breaking than fixing. Folks, if you want to steal a cat, this is the place. The lights don’t work and the camera’s out.

Talk Description

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 them 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!