Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@async blocks #248

Closed
rikhuijzer opened this issue Aug 12, 2022 · 1 comment
Closed

@async blocks #248

rikhuijzer opened this issue Aug 12, 2022 · 1 comment

Comments

@rikhuijzer
Copy link
Contributor

Is the following behaviour expected? The Time should be 10 seconds, that is, the meter should run concurrently during the "long" running fib computation. However, it always takes more than 10 seconds to finish:

julia> using ProgressMeter

julia> function show_progress()
           p = ProgressMeter.ProgressUnknown()
           for i in 1:10
               ProgressMeter.update!(p)
               sleep(1)
           end
           ProgressMeter.finish!(p)
       end;

julia> fib(n) = n <= 1 ? n : fib(n - 1) + fib(n - 2);

julia> @time fib(44);
  4.591181 seconds

julia> show_progress()
Progress:  0 	 Time: 0:00:10

julia> @async(fib(44)); show_progress();
Progress:  0 	 Time: 0:00:13

julia> @async(show_progress()); fib(44); # This one blocks for a few seconds before it starts.

Progress:  0 	 Time: 0:00:10
@MarcMush
Copy link
Collaborator

I don't think that's a problem with ProgressMeter, I see the same behavior with println(i)

function show_progress()
    for i in 1:10
        println(i)
        sleep(1)
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants