Skip to content

Commit

Permalink
Benchmark application config lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
slashdotdash committed Nov 20, 2019
1 parent e758359 commit 9802c97
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ erl_crash.dump
.elixir_ls
/priv/plts/*.plt
/priv/plts/*.plt.hash
/bench/graphs
/bench/snapshots
17 changes: 17 additions & 0 deletions bench/application/config_bench.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defmodule Commanded.Application.ConfigBench do
use Benchfella

alias Commanded.Application.Config
alias Commanded.ExampleApplication

setup_all do
{:ok, _apps} = Application.ensure_all_started(:commanded)
{:ok, pid} = ExampleApplication.start_link()

{:ok, pid}
end

bench "lookup config" do
{_adapter, _config} = Config.get(ExampleApplication, :event_store)
end
end
4 changes: 4 additions & 0 deletions config/bench.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use Mix.Config

# No logging for benchmarking
config :logger, backends: []
5 changes: 3 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Commanded.Mixfile do
]
end

defp elixirc_paths(:test),
defp elixirc_paths(env) when env in [:bench, :test],
do: [
"lib",
"test/aggregates/support",
Expand Down Expand Up @@ -58,10 +58,11 @@ defmodule Commanded.Mixfile do
{:phoenix_pubsub, "~> 1.1", optional: true},

# Build and test tools
{:benchfella, "~> 0.3", only: :bench},
{:dialyxir, "~> 1.0.0-rc.7", only: :dev, runtime: false},
{:ex_doc, "~> 0.21", only: :dev},
{:mix_test_watch, "~> 1.0", only: :dev},
{:mox, "~> 0.5", only: :test}
{:mox, "~> 0.5", only: [:bench, :test]}
]
end

Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%{
"benchfella": {:hex, :benchfella, "0.3.5", "b2122c234117b3f91ed7b43b6e915e19e1ab216971154acd0a80ce0e9b8c05f5", [:mix], [], "hexpm"},
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.7", "6287f8f2cb45df8584317a4be1075b8c9b8a69de8eeb82b4d9e6c761cf2664cd", [:mix], [{:erlex, ">= 0.2.5", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm"},
"earmark": {:hex, :earmark, "1.4.2", "3aa0bd23bc4c61cf2f1e5d752d1bb470560a6f8539974f767a38923bb20e1d7f", [:mix], [], "hexpm"},
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm"},
Expand Down
1 change: 0 additions & 1 deletion test/event_store/support/subscriber.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule Commanded.EventStore.Subscriber do
use GenServer

alias Commanded.EventStore
alias Commanded.EventStore.Subscriber

defmodule State do
Expand Down

0 comments on commit 9802c97

Please sign in to comment.