Marcus

Marcus

BencheeDsl - ExUnit style and a livebook smart cell for benchee

Hi!

BencheeDsl provides a DSL for the great Benchee (micro) benchmarking tool.

With the DSL you can write benchmarks like:

defmodule Benchmark do
  use BencheeDsl.Benchmark

  config time: 3, pre_check: true, print: [configuration: false]

  inputs %{
    "Small" => Enum.to_list(1..1_000),
    "Medium" => Enum.to_list(1..10_000),
    "Bigger" => Enum.to_list(1..100_000)
  }

  defp map_fun(i), do: [i, i * i]

  job flat_map(input) do
    Enum.flat_map(input, &map_fun/1)
  end

  job map_flatten(input) do
    input |> Enum.map(&map_fun/1) |> List.flatten()
  end
end

The lib comes with two mix tasks. One to generate the bench directory and bench/benchee_helper.exs. The mix bench task will run the benchmarks found by bench/*_bench.exs.

BencheeDsl comes also with support for livebook and with the Benchee smart cell. See benchee_dsl.livemd.

The Benchee smart cell is my very first attempt at writing a smart cell.

Thanks for reading!

Most Liked

Marcus

Marcus

The smart cell renders now markdown when benchee_markdown is installed.

Marcus

Marcus

I was wondering how your Livebook integration differs from kino_benchee , and whether it might make sense for you to contribute any enhancements you’ve made to that project, if you have the time.

In benchee_dsl the integration is quite easy, just %Benchee.Suite{} |> Benchee.Formaters.Markdown.redner() |> Kino.Markdown.new(). kino_benchee implements defimpl Kino.Render, for: Benchee.Suite. So the implementation is cleaner and more general. kino_benchee uses also some new upcoming features of Livebook next version and renders some nice charts with kino_vega_lite. The package waits for on change in benchee and for the next Livebook version. I will remove the Livebook integration in benchee_dsl as soon as kino_benchee is available.

Where Next?

Popular in Libraries Top

devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: https://github.com/devonestes/assertions ...
New
mathieuprog
Hello :wave: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First and fore...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
archan937
It is a well-know topic within the Elixir community: “To mock or not to mock? :)” Every alchemist probably has his / her own opinion con...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
michalmuskala
Another small library today. PersistentEts Hex: persistent_ets | Hex GitHub: GitHub - michalmuskala/persistent_ets Ets table backed by...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
benlime
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
New
ericlathrop
I built a silly site for Halloween that uses Phoenix Channels on the backend, and React on the frontend. I had many problems integrating ...
New
gjaldon
As the title states, EctoEnum has just been updated after some time of hardly any activity in the repo. Here’s the latest release: https:...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Sub Categories:

We're in Beta

About us Mission Statement