It can happen sometimes that you work with Elixir and then you want to benchmark something. So, what will you use? We have a hint for you. Benchee is a library for micro benchmarking in Elixir that allows you to compare the performance of different pieces of code at a glance.
Benchee is easy in use and can run each benchmarking function you give it for a given amount of time and then compute statistics from it. Benchee provides you with:
- average run time
- iterations per second
- standard deviation
It has so many great features that can surprise you, for example, it:
- first runs the functions for a given warmup time without recording the results,
- measures memory usage,
- provides you with lots of statistics,
- plugin/extensible friendly architecture so you can use different formats to display benchmarking results as HTML, markdown, JSON and more,
- nicely formatted console output with units scaled to appropriately,
- measures the overhead of function calls,
- hooks to execute something before/after a benchmarking invocation,
- execute benchmark jobs in parallel to gather more results in the same timу,
- well documented and well tested.
Excited? Then check all the necessary information here.
And if you want to explore with us the Elixir Concurrency example and put it in practice, you are always welcomed!