This is my kitchen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Calculating ------------------------------------- | |
array 45.561k i/100ms | |
regexp 48.843k i/100ms | |
------------------------------------------------- | |
array 711.188k (± 5.8%) i/s - 3.554M | |
regexp 797.338k (± 5.9%) i/s - 4.005M | |
Comparison: | |
regexp: 797337.6 i/s | |
array: 711187.6 i/s - 1.12x slower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule CaseBench do | |
use Benchfella | |
defp ok_or_error_with_atom do | |
Stream.cycle([:ok, {:error, :err}]) | |
|> Enum.take(1000) | |
end | |
defp ok_or_error_with_string do | |
Stream.cycle([:ok, {:error, "err"}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List = fun () -> | |
L = lists:seq(1, 1000), | |
lists:map(fun(_) -> ok end, L) ++ lists:map(fun(_) -> {error, "error"} end, L) | |
end. | |
Withcase = fun(X) -> | |
case X of | |
ok -> | |
case X of | |
ok -> ok; |