1 Nov
2026
1 Nov
'26
4:05 a.m.
I am considering a use of capy that looks like the following: for (auto i = 0; i < m; ++i) { capy::thread_pool pool(0); for (auto j = 0; j < n; ++j) { capy::run_async(pool.get_executor())(task[j]()); } pool.join(); } I am wondering about the overhead of constructing/deconstructing a heap of thread pools in the outer loop. Does it make sense to pre-construct m of them prior to the loop and then use the ith one within the loop? Is there a better pattern to use for this? Is this the most efficient way to execute a bunch of independent tasks in parallel? This is the first time I am working through capy, so all suggestions are welcome. Thanks a lot. Cheers, Brook