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

@btime not printing as expected in a loop in Atom #184

Closed
Luapulu opened this issue Dec 23, 2020 · 4 comments
Closed

@btime not printing as expected in a loop in Atom #184

Luapulu opened this issue Dec 23, 2020 · 4 comments

Comments

@Luapulu
Copy link

Luapulu commented Dec 23, 2020

When I'm comparing different versions of a function I like to do something like

function func1(x)
    # code
end

function func2(x)
    # code
end

function func3(x)
    # code
end

for i in 1:3
    print(i, ": ")
    @btime $(Symbol(:func, i))($(12345))
end

I'd expect this to print something like

1:   19.682 μs (914 allocations: 42.84 KiB)
2:   21.141 μs (914 allocations: 42.84 KiB)
3:   21.889 μs (914 allocations: 42.84 KiB)

but I get

19.682 μs (914 allocations: 42.84 KiB)
2:   21.141 μs (914 allocations: 42.84 KiB)
3:   21.889 μs (914 allocations: 42.84 KiB)

What's going on?

@calebwin
Copy link

I'm having the same issue and it would be great to get some insight on this.

@KristofferC
Copy link
Contributor

Works fine for me:

julia> for i in 1:3
           print(i, ": ")
           @btime $(Symbol(:func, i))($(Ref(12345))[])
       end
1:   1.214 ns (0 allocations: 0 bytes)
2:   1.017 ns (0 allocations: 0 bytes)
3:   1.058 ns (0 allocations: 0 bytes)

@bojeryd91
Copy link

This looks like a common bug when running in Atom. Often when I print to the terminal, the first print is ignored. I therefore add a print("") if I am trying to align something.

@gdalle gdalle changed the title @btime not printing as expected in a loop @btime not printing as expected in a loop in Atom Jun 13, 2023
@gdalle
Copy link
Collaborator

gdalle commented Jun 13, 2023

Closing this since Atom has been deprecated

@gdalle gdalle closed this as completed Jun 13, 2023
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

No branches or pull requests

5 participants