Why so much difference in performance between Thread and Task?

后端 未结 6 1413
独厮守ぢ
独厮守ぢ 2020-12-14 16:36

Windows 7, Intel CORE i3, 64 bit, RAM 4Gb, 2.27 GHz
.NET Framework 4.0

I have the following code:

static void Main(string[] args)
{
             


        
6条回答
  •  攒了一身酷
    2020-12-14 16:44

    Creating new threads is slow, but not that slow. Nick reported ~10ms/thread. Most likely it happened under Visual Studio debugger. I am getting ~3.9ms per new thread under Visual Studio debugger. I am getting ~0.15ms per new thread without debugger.

    http://dennisgorelik.livejournal.com/125269.html?thread=2238805#t2238805

提交回复
热议问题