diff --git a/benchmarks/README.md b/benchmarks/README.md index af30ea4..db589ca 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -2,8 +2,16 @@ Some simple benchmark scripts for the package. Use them as they are or modify them to test specific scenarios. -Example: +Example with Redis: ``` -mix run benchmarks/flag.exs +rm -r _build/dev/lib/fun_with_flags/ && +PERSISTENCE=redis CACHE_ENABLED=true mix run benchmarks/flag.exs +``` + +Running the benchmarks with Ecto: + +``` +rm -r _build/dev/lib/fun_with_flags/ && +PERSISTENCE=ecto RDBMS=postgres CACHE_ENABLED=false mix run benchmarks/persistence.exs ``` diff --git a/benchmarks/cache.exs b/benchmarks/cache.exs index 438a784..a0fd9b2 100644 --- a/benchmarks/cache.exs +++ b/benchmarks/cache.exs @@ -1,7 +1,11 @@ # :observer.start +Logger.configure(level: :error) + # Start the ecto repo if running the benchmarks with ecto. -# {:ok, _pid} = FunWithFlags.Dev.EctoRepo.start_link() +if System.get_env("PERSISTENCE") == "ecto" do + {:ok, _pid} = FunWithFlags.Dev.EctoRepo.start_link() +end FunWithFlags.clear(:one) FunWithFlags.clear(:two) diff --git a/benchmarks/flag.exs b/benchmarks/flag.exs index 728265f..cd02022 100644 --- a/benchmarks/flag.exs +++ b/benchmarks/flag.exs @@ -1,7 +1,11 @@ # :observer.start +Logger.configure(level: :error) + # Start the ecto repo if running the benchmarks with ecto. -# {:ok, _pid} = FunWithFlags.Dev.EctoRepo.start_link() +if System.get_env("PERSISTENCE") == "ecto" do + {:ok, _pid} = FunWithFlags.Dev.EctoRepo.start_link() +end FunWithFlags.clear(:one) FunWithFlags.clear(:two) diff --git a/benchmarks/persistence.exs b/benchmarks/persistence.exs index eecae82..97d0a99 100644 --- a/benchmarks/persistence.exs +++ b/benchmarks/persistence.exs @@ -5,8 +5,12 @@ # :observer.start +Logger.configure(level: :error) + # Start the ecto repo if running the benchmarks with ecto. -# {:ok, _pid} = FunWithFlags.Dev.EctoRepo.start_link() +if System.get_env("PERSISTENCE") == "ecto" do + {:ok, _pid} = FunWithFlags.Dev.EctoRepo.start_link() +end FunWithFlags.clear(:one) FunWithFlags.clear(:two)