Quick question, is there a mini-package that defines something like the following:
# prime time
# (saner name, e.g: htime, for 'human' time)
t0 = time()
Δt = time() - t0
@printf("%.2G seconds\n", Δt)
Most of the times that I use
@time I don’t have to know about memory allocations or more than 2 significant digits of time duration.
I wager I’m not alone?
Given that, I wondered if it would be an idea to add something like this to Base. An anti-
@timev (time verbose)
Has there been previous discussion on this that I’ve missed?
To explain a bit further: quick-n-dirty analyses I write often consist of multiple steps, and I print feedback between these steps on what is happening and how long the last step took
Goals are to know: is it computing, or is it hanging / did it crash? At what step are we know? How long did that take?
@btime is just as noisy, and possible repeats work, right?
TimerOutputs.jl but it looked a bit overkill for quick scripts; but I’ll give it a try, it might be exactly what I need
Edit: No, my impression was right. It doesn’t seem to give live feedback during the running of the expression, and takes more code than
Looks like a great package but not what I was looking for
I’ve gotten a lot of mileage out of GitHub - timholy/ProgressMeter.jl: Progress meter for long-running computations though for similar use cases
@ellapsed does that (except for the units)?
@elapsed doesn’t print any output, though, which seems to be the point of the question. The nice thing about
@time is that it times, prints the timing information, and doesn’t change the returned value (i.e.,
@time 1 + 1 will return
@elapsed 1 + 1 will return the duration of the operation), all with minimal typing.