Chris Elrod

Results 837 comments of Chris Elrod

```julia function with_batch_sleep() # Just some loop with @batch with basically no runtime @batch for i in 1:2 nothing end ThreadingUtilities.sleep_all_tasks() # This is just to make sure that the...

It's ridiculous that this is slow: ```julia julia> function with_thread() Threads.@threads for i in 1:2 nothing end # This is just to make sure that the allocation in the next...

I think `ThreadingUtilities.sleep_all_tasks()` should be exported by `Polyester`, and mentioned prominently in the `README` as the likely fix to any unexpected slowdowns.

Polyester/ThreadingUtilities block excess threads for a few milliseconds while looking for work to do. `sleep_all_tasks` makes them go to sleep. Base threading does as well, but for not as long:...

I think we can close this issue once someone adds a section on the README (preferably close to the top, as it's an important gotcha). PRs welcome :).

It could be simple and merely suggest trying it when you see unexpected regressions. > How is the longer sleep threshold of Polyester problematic here? I am not sure why....

Can you provide a minimal example I can run?

> Replacing Threads.@threads with @batch per=thread in the loop I linked generates the problem, but I understand that's not really "Minimal." While not ideal, having code to call `psis` would...

What I'd do from there is store `post_sample_size`, `r_eff`, and `weights` and hopefully produce a minimal example from that. ```julia @inbounds Threads.@threads for i in eachindex(tail_length) tail_length[i] = def_tail_length(post_sample_size, r_eff[i])...

> I see; how do I get those to you after that? If they're big, then there isn't really a convenient way. I'll look at the test suite.