Apparently the TaskFactory.StartNew
method in .NET 4.0 is intended as a replacement for ThreadPool.QueueUserWorkItem
(according to this post, anyway). My question is simple: does anyone know why?
Does TaskFactory.StartNew
have better performance? Does it use less memory? Or is it mainly for the additional functionality provided by the Task
class? In the latter case, does StartNew
possibly have worse performance than QueueUserWorkItem
?
It seems to me that StartNew
would actually potentially use more memory than QueueUserWorkItem
, since it returns a Task
object with every call and I would expect that to result in more memory allocation.
In any case, I'm interested to know which is more appropriate for a high-performance scenario.