.net - TaskFactory.StartNew versus ThreadPool.QueueUserWorkItem -
Apparently the method is substituted as the replacement for .NET 4.0 (). My question is simple: does anyone know why?
What is the That In any case, I am interested in knowing which one is more suitable for high performance scenario. TaskFactory.StartNew
better performance? Does it use less memory? Or is it mainly for additional functionality provided by the task
class? In the latter case, StartNew
might display worse
from
StartNew
will actually use memory in comparison to more QueueUserWorkItem
, because it has a task with each call
object and I hope this results in more memory allocation.
The display is one ... depending on if you are doing multiple parallel functions, then the NAT4 function Will perform better, and give you more precise control (more strong cancellation, ability to wait simultaneously on many tasks, parent / child ability to make work relation, longrunning ability etc .. etc .. etc)
In addition, do your own work Ishtkrta means the ability to specify that you can customize for your needs. The built-in task scheduler has more multi-core information than the old Threadpool.
To use more memory, each thread keeps a minimum of 1 MB of memory, the small amount used to store the work object is unimportant. I really think that your last concern is .
Comments
Post a Comment