Skip to content

running Task.WhenAll + ConcurrentQueue + Task.Yield() in netcoreapp2.1 is slower than netcoreapp2.0 #26121

@itn3000

Description

@itn3000

I ran the benchmark with the following cases;

  1. Task.WhenAll and only do await Task.Yield
  2. Task.WhenAll and only returns Task.CompletedTask
  3. Task.WhenAll and do await Task.Yield, and then ConcurrentQueue<int>.Enqueue 10000 times.
  4. Task.WhenAll and do ConcurrentQueue<int>.Enqueue 10000 times, then returns Task.CompletedTask

case 1,2,4 in netcoreapp2.1 are faster than or mostly same as netcoreapp2.0,
but case 3 is slower than netcoreapp2.0 by 2-3 times.

here is my benchmark code and results and dotnet --info output;

.NET Core SDK (global.json を反映):
 Version:   2.1.300-rc1-008673
 Commit:    f5e3ddbe73

ランタイム環境:
 OS Name:     Windows
 OS Version:  6.3.9600
 OS Platform: Windows
 RID:         win81-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300-rc1-008673\

Host (useful for support):
  Version: 2.1.0-rc1
  Commit:  eb9bc92051

.NET Core SDKs installed:
  2.1.100 [C:\Program Files\dotnet\sdk]
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.300-rc1-008673 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-rc1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions