On 2011-03-24 03:29:52 -0400, Sönke Ludwig
<[email protected]> said:
Hm depending on the way the pool is used, it might be a better default
to have the number of threads equal the number of cpu cores. In my
experience the control thread is mostly either waiting for tasks or
processing messages and blocking in between so it rarely uses a full
core, wasting the available computation time in this case.
However, I'm not really sure if it is like this for the majority of all
applications or if there are more cases where the control thread will
continue to do computations in parallel. Maybe we could collect some
opinions on this?
The current default is good for command line applications where the
main thread generally blocks while you're doing your work. The default
you're proposing is good when you're using the task pool to pile up
tasks to perform in background, which is generally what you do in an
event-driven application. The current default is good to keeps simpler
the simpler programs which are more linear in nature.
My use case is like yours: a event-driven main thread which starts
tasks to be performed in the background.
--
Michel Fortin
[email protected]
http://michelf.com/