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

make sure that nullfunc is not ellided #164

Merged
merged 1 commit into from
Apr 19, 2020
Merged

Conversation

vchuravy
Copy link
Member

fixes #163

We don't use these functions by default to estimate the overhead,
but right now they give the answer of:

before = time_ns()
after = time_ns()
(after-before)/evals

Which is not a particular helpful estimate of the costs. With
a inference barrier we have a for-loop and a call to a function.

We explicitly note in https://github.com/JuliaCI/BenchmarkTools.jl/blob/master/doc/manual.md#understanding-compiler-optimizations
that compiler optimizations like that have to be accounted for by the user

This is more accurate and seems more stable, but requires a large number
of iterations to converge, probably means we should revitalize #94.

julia> BenchmarkTools.overhead_sample(10000)
2.8025

julia> BenchmarkTools.overhead_sample(10000)
6.3016

julia> BenchmarkTools.overhead_sample(10000)
5.5982

julia> BenchmarkTools.overhead_sample(10000)
6.3029

julia> BenchmarkTools.overhead_sample(10000)
6.2975

julia> BenchmarkTools.overhead_sample(10000)
5.5966

julia> BenchmarkTools.overhead_sample(100000)
5.79436

julia> BenchmarkTools.overhead_sample(1000000)
5.312702

julia> BenchmarkTools.overhead_sample(10000000)
3.9741005

julia> BenchmarkTools.overhead_sample(100000000)
1.59801717

julia> BenchmarkTools.overhead_sample(1000000000)
1.385175517

julia> BenchmarkTools.overhead_sample(10000000000)
1.3278229344

julia> BenchmarkTools.overhead_sample(100000000000)
1.37250904273

Copy link
Member

@jrevels jrevels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about Base.inferencebarrier, that's a dope little addition

@vchuravy vchuravy merged commit 451b070 into master Apr 19, 2020
@vchuravy vchuravy deleted the vc/compiler_barrier branch April 19, 2020 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overhead_sample(evals) and estimate_overhead() gives lower values, the higher "evals" is
2 participants