Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daviehh/timedloop
Julia timed for loop
https://github.com/daviehh/timedloop
julia timing utility
Last synced: 1 day ago
JSON representation
Julia timed for loop
- Host: GitHub
- URL: https://github.com/daviehh/timedloop
- Owner: daviehh
- License: mit
- Created: 2020-01-02T20:26:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-02T20:30:07.000Z (almost 5 years ago)
- Last Synced: 2023-11-15T02:46:40.320Z (12 months ago)
- Topics: julia, timing, utility
- Language: Julia
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Timed for loop
For long-running `for` loops where each loop takes approximately the same time to run, this macro calculates the average time per iteration and estimates when the loop will finish.
- Usage:
```julia
@tml [verbose]
````verbose` is an optional Boolean controlling if the output should be verbose:
- `false` (default): only print the timing information for the first 10 iterations, then every 10 iterations; or if the average per-iteration run time is more than 5 seconds
- `true`: print timing information every iteration; shortcut `@tmlv`- example (see example.jl)/TLDR:
```julia
using TimedLoopnl = 20
c = rand(nl)@tml for j = 1:nl
c[j] = j
sleep(.1)
println("looping $j")
end@tml true for j = 1:nl
c[j] = j
sleep(.1)
println("looping $j")
end# equivalently
@tmlv for j = 1:nl
c[j] = j
sleep(.1)
println("looping $j")
end```