Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks only track minimum number of allocations and memory usage #277

Open
Arkoniak opened this issue Feb 19, 2022 · 1 comment
Open

Comments

@Arkoniak
Copy link

It seems, that BenchmarkTools.Trial uses only single value for storing number of allocations and memory usage during trial runs. And judging from the results it track only minimum allocations and memory. Somewhat exaggerated example:

using BenchmarkTools

function f()
    n = rand() < 0.5 ? 1 : 100000
    return rand(n)
end

and result

julia> @benchmark f() evals = 1
BenchmarkTools.Trial:
  memory estimate:  64 bytes
  allocs estimate:  1
  --------------
  minimum time:     55.000 ns (0.00% GC)
  median time:      86.357 μs (0.00% GC)
  mean time:        56.463 μs (3.11% GC)
  maximum time:     573.892 μs (45.10% GC)
  --------------
  samples:          10000
  evals/sample:     1

which doesn't feel right.

@gdalle
Copy link
Collaborator

gdalle commented Jun 13, 2023

There are several reasons why the minimum is a good choice for benchmarking, but I agree it should be better documented

@gdalle gdalle added this to the v2.0 milestone Sep 18, 2023
@gdalle gdalle removed this from the v2.0 milestone Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants