Skip to content

Instantly share code, notes, and snippets.

@sergey-chechaev
Last active May 14, 2019 16:21
Show Gist options
  • Save sergey-chechaev/5cfceb505dc9cd2c1e86e68b65b59d39 to your computer and use it in GitHub Desktop.
Save sergey-chechaev/5cfceb505dc9cd2c1e86e68b65b59d39 to your computer and use it in GitHub Desktop.
benchmarking feed
Benchee.run(%{
"Preload 1 query sync" => fn -> one_query |> Repo.all(in_parallel: false) end,
"Preload 1 query async" => fn -> one_query |> Repo.all(in_parallel: true) end,
"Preload 5 query async" => fn -> five_query |> Repo.all(in_parallel: true) end,
"Preload 5 query sync" => fn -> five_query |> Repo.all(in_parallel: false) end
}, time: 10, memory_time: 2, warmup: 5)
Name ips average deviation median 99th %
Preload 5 query async 191.25 5.23 ms ±25.81% 4.96 ms 10.02 ms
Preload 1 query sync 184.57 5.42 ms ±27.04% 5.21 ms 8.71 ms
Preload 1 query async 181.26 5.52 ms ±32.14% 5.24 ms 9.21 ms
Preload 5 query sync 111.59 8.96 ms ±69.42% 8.51 ms 16.53 ms
Comparison:
Preload 5 query async 191.25
Preload 1 query sync 184.57 - 1.04x slower
Preload 1 query async 181.26 - 1.06x slower
Preload 5 query sync 111.59 - 1.71x slower
Memory usage statistics:
Name average deviation median 99th %
Preload 5 query async 144.58 KB ±0.02% 144.59 KB 144.59 KB
Preload 1 query sync 839.27 KB ±0.05% 839.48 KB 839.62 KB
Preload 1 query async 839.33 KB ±0.05% 839.48 KB 840.18 KB
Preload 5 query sync 344.37 KB ±0.00% 344.37 KB 344.37 KB
Comparison:
Preload 5 query async 144.59 KB
Preload 1 query sync 839.48 KB - 5.81x memory usage
Preload 1 query async 839.48 KB - 5.81x memory usage
Preload 5 query sync 344.37 KB - 2.38x memory usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment