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

Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps...
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
blatyo
https://www.conduitframework.com/ The best overview for how things are tied together is this presentation. Modules and functions are pre...
New
asiniy
Hey there! I wrote a download elixir package which does exactly what its name about - an easy way to download files. I saw solutions ...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: https://github.com/tmbb/phoenix_ws Phoenix channels are a great...
New
Qqwy
While not as prevalent as in imperative languages, arrays (collections with efficient random element access) are still very useful in Eli...
New
KallDrexx
For a good number of months I've been working on creating a very basic RTMP live video streaming server. Now that I have a very, very ba...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
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
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New

Sub Categories:

We're in Beta

About us Mission Statement