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

Function undefined for @btime when using for loop #280

Open
bojeryd91 opened this issue Mar 13, 2022 · 2 comments
Open

Function undefined for @btime when using for loop #280

bojeryd91 opened this issue Mar 13, 2022 · 2 comments
Labels

Comments

@bojeryd91
Copy link

bojeryd91 commented Mar 13, 2022

Unlike @time, @btime throws an error that fun is undefined when I run

using BenchmarkTools
f(x) = x^2; g(x) = x^3; h(x) = x^4
@btime f(2.0) # This works

for fun in (f, g, h)
    @time  fun(1.0)
    @btime fun(1.0) # This throws UndefVarError: fun not defined
end

I am running BenchmarkTools v1.3.1 and Julia 1.6.0

@vchuravy
Copy link
Member

Please quote your code snippets to not ping other people.

@gdalle gdalle changed the title Fun undefined for @btime when using for loop Function undefined for @btime when using for loop Jun 13, 2023
@gdalle gdalle added the bug label Jun 13, 2023
@gdalle
Copy link
Collaborator

gdalle commented Jun 13, 2023

Note that it works if you interpolate $fun, which is the right thing to do anyway. But it still shouldn't error without interpolation

@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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants