Redirect `@time` output into a string

alex180500
Fri, 17 Jan 2025 11:59:24 +0000
General Usage

Hello! working in a for loop I want to time a long computation with @time and I want to output the stdout into a string (that i’m using later in the for loop).

for _ in 1:num_loops
    @time myvar = longcomputation()
end

I want to keep the @time output inside a string variable and I also want to keep myvar as it get used later. How can I achieve this?

3 posts - 2 participants