Skip to content

Microsoft.NET.Test.Sdk v16.7.0 and later are ~4x slower than v16.6.1 #2623

Closed

Description

Description

Microsoft.NET.Test.Sdk v16.7.0 and later are ~4x slower than v16.6.1

I reported #2215 a year ago, maybe these issues are related. That issue was fixed and I closed it.

What changed between 16.6.1 and 16.7.0? Serializing more data? Used new serializer version/nuget? Or something else?

Steps to reproduce

.NET: 5.0.100

ClassLibrary1.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <!-- 16.6.1 or 16.9.0-preview-20201020-06 -->
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.0-preview-20201020-06" />
    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.console" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
  </ItemGroup>

</Project>

Class1.cs:

using System.Collections.Generic;
using Xunit;

namespace ClassLibrary1
{
    public class Class1
    {
        [Theory]
        [MemberData(nameof(TestData))]
#pragma warning disable xUnit1026 // Theory methods should use all of their parameters
        public void Test1(int value)
#pragma warning restore xUnit1026 // Theory methods should use all of their parameters
        {
        }
        public static IEnumerable<object[]> TestData {
            get {
                for (int i = 0; i < 100_000; i++)
                    yield return new object[] { i };
            }
        }
    }
}

repro:

  • Run the commands below
  • Change the Microsoft.NET.Test.Sdk version: 16.6.1 <--> 16.9.0-preview-20201020-06
  • Run the commands below again
dotnet build -v:m -c Release ClassLibrary1.csproj
Measure-Command { dotnet test -c Release -f net5.0 --no-build ClassLibrary1.csproj | Out-Default }
Version Time Verdict
16.6.1 18.9 seconds ✔️
16.9.0-preview-20201020-06 65.7 seconds

Environment

Windows 10 20H2

Ubuntu 20.04 (WSL2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions