Way to add progress bar to map function?


#1

What would be the best way to add a loading bar (or just simple dots) to a map function

This is for maps that can take several minutes.


i.e.

function foo(x)
  sleep(x)
  x ^ 2
end

cur_range = 1:3

map(x -> foo(x), cur_range)

Does anyone have a progress bar for pmap?
#2

https://github.com/timholy/ProgressMeter.jl supports for-loops but not map(), but I bet it could be adapted for your use case.


#3

You’re right.

There seems to be a pull request out for it already:


#4

Also, you can already use a comprehension, so instead of map(foo, cur_range), you can do @showprogress [foo(x) for x in cur_range]