On 15/05/2011 17:04, dsimcha wrote:
On 5/15/2011 11:41 AM, Robert Clipsham wrote:
Automatically using a parallel algorithm if it's likely to improve
speed? Awesome. I assume that std.parallelism sets up a thread pool upon
program start so that you don't have the overhead of spawning threads
when you use a parallel algorithm for the first time?
No, it does so lazily. It seemed silly to me to do this eagerly when it
might never be used. If you want to make it eager all you have to do is
reference the taskPool property in the first line of main().
Fair enough, I guess that makes more sense. But surely if you import
std.parallelism then you plan on using it? In which case initialization
in a static this() would probably be a good idea? (Although I guess that
means you can't customize the number of worker threads, in the case
where it can't automatically be detected for whatever reason?)
--
Robert
http://octarineparrot.com/