diff options
author | Jordan Bracco <href@random.sh> | 2020-05-16 12:17:40 +0200 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2020-05-16 12:22:30 +0200 |
commit | 447b4c9a2e99a37c0d17e01e79d786f2c11590f5 (patch) | |
tree | 87202b1b8e9b09a46ad862a475af0664e5dd753a /test/samples/update_counter.exs | |
parent | Remove ETS backend, add max_retries, add options to limit/3. (diff) |
Format and prepare for release
Diffstat (limited to '')
-rw-r--r-- | test/samples/update_counter.exs | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/test/samples/update_counter.exs b/test/samples/update_counter.exs index 6310c57..1d8e837 100644 --- a/test/samples/update_counter.exs +++ b/test/samples/update_counter.exs @@ -1,20 +1,25 @@ :ets.new(:limiter_bench, [:public, :named_table]) -:ets.new(:limiter_bench_concurrent, [:public, :named_table, {:read_concurrency, false}, {:write_concurrency, true}]) + +:ets.new(:limiter_bench_concurrent, [ + :public, + :named_table, + {:read_concurrency, false}, + {:write_concurrency, true} +]) + atomics = :atomics.new(1, []) -update_counter = - %{ - "ets:update_counter" => fn -> - :ets.update_counter(:limiter_bench, "bench", {2, 1}, {"bench", 0}) - end, - "ets:update_counter concurrent" => fn -> - :ets.update_counter(:limiter_bench, "bench", {2, 1}, {"bench", 0}) - end, - "atomics:add_get" => fn -> - :atomics.add_get(atomics, 1, 1) - end, - } +update_counter = %{ + "ets:update_counter" => fn -> + :ets.update_counter(:limiter_bench, "bench", {2, 1}, {"bench", 0}) + end, + "ets:update_counter concurrent" => fn -> + :ets.update_counter(:limiter_bench, "bench", {2, 1}, {"bench", 0}) + end, + "atomics:add_get" => fn -> + :atomics.add_get(atomics, 1, 1) + end +} Benchee.run(update_counter, parallel: 1) Benchee.run(update_counter, parallel: System.schedulers_online()) - |