Skip to content

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

@Luapulu

Description

@Luapulu

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions