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

Warn against possible code invalidations #167

Open
cossio opened this issue May 23, 2020 · 1 comment
Open

Warn against possible code invalidations #167

cossio opened this issue May 23, 2020 · 1 comment

Comments

@cossio
Copy link

cossio commented May 23, 2020

Suppose I execute the following code in a fresh REPL (I haven't imported SpecialFunctions):

julia> f(x) = erf(x);
julia> f(1)
ERROR: UndefVarError: erf not defined
Stacktrace:
 [1] f(::Int64) at ./REPL[1]:1
 [2] top-level scope at REPL[2]:1
julia> using BenchmarkTools, SpecialFunctions
julia> x = 1; @btime f($x);
  27.645 ns (1 allocation: 16 bytes)

This allocation is not "real". See upstream issue: JuliaLang/julia#35889. If I start a new fresh REPL, and this time load SpecialFunctions at the beginning:

julia> using BenchmarkTools, SpecialFunctions
julia> f(x) = erf(x);
julia> x = 1; @btime f($x);
  22.195 ns (0 allocations: 0 bytes)

the allocation is gone.

I think we should warn about this in the README or the docs.

@gdalle gdalle added this to the v2.0 milestone Sep 18, 2023
@gdalle
Copy link
Collaborator

gdalle commented Sep 18, 2023

I think the more general issue is to warn that benchmarks will show results even when the function throws an exception?

@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