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
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.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










