Benchmarking Functions in Elixir with Benchee

Benchmarking is often useful to measure the performance of a function with inputs of different sizes. It’s especially true in Elixir where the tools give you many approaches to solving a problem, such as parallelism, but also introduce some overhead of message passing.

Benchee is an Elixir library that can be used to generate reports of the performance of different functions. Both iterations per second and memory consumption of a function can be generated, with results showing the statistical spread of the function’s performance.

Benchee has a number of great features that make running useful benchmarks easy. You can configure multiple inputs for measuring a function’s Big O performance. You can set up pre-checks so functions are validated before benchmarks are run. You can add hooks so that setup and teardown that shouldn’t influence your benchmark can be easily managed. And importantly, you can have the reports output in different formats, including HTML.

In this video, we’ll cover all these features of Benchee, comparing 2 functions as we do so.

Sign up for our newsletter

Get notified of any new episodes as we release them.

© 2020 QuantLayer, LLC. All rights reserved.