Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
🧱 run bench only in dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelStark committed Sep 24, 2024
1 parent b444e3a commit f08ecea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
32 changes: 18 additions & 14 deletions lib/gakimint/mix/tasks/bench.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ defmodule Mix.Tasks.Bench do
secret_msg = "test_message"
{r, _r_pub} = BDHKE.generate_keypair(<<1::256>>)

# Run the BDHKE benchmark
Benchee.run(
%{
"BDHKE End-to-End Flow" => fn ->
run_bdhke_flow(a, a_pub, secret_msg, r)
end
},
formatters: [
Benchee.Formatters.HTML,
Benchee.Formatters.Console
],
time: 10,
memory_time: 2
)
if Code.ensure_loaded?(Benchee) do
# Run the BDHKE benchmark
Benchee.run(
%{
"BDHKE End-to-End Flow" => fn ->
run_bdhke_flow(a, a_pub, secret_msg, r)
end
},
formatters: [
Benchee.Formatters.HTML,
Benchee.Formatters.Console
],
time: 10,
memory_time: 2
)
else
IO.puts("Benchee is not available. Make sure you're running in the :dev environment.")
end
end

def run_bdhke_flow(a, a_pub, secret_msg, r) do
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ defmodule Gakimint.MixProject do
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test
"coveralls.html": :test,
bench: :dev
]
]
end
Expand Down

0 comments on commit f08ecea

Please sign in to comment.