.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 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

That 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.

In any case, I am interested in knowing which one is more suitable for high performance scenario.

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

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -