Minimal Reproduce Example with C#13 being 3 times slower than C#10

Правка en1, от JasonMendoza2008, 2025-07-15 17:20:13

MRE:

using System.Collections.Generic;

namespace cp;

internal static class Codeforces
{
    public static void Main()
    {
        SortedSet<int> mySortedSet = new SortedSet<int>();
        for (int i = 0; i < 1000000; i++) {
            mySortedSet.Add(i);
        }
        Console.WriteLine(mySortedSet.Min);
        Console.WriteLine(mySortedSet.Max);
    }
}

1030 ms with C#13, 358 ms with C#10.

As a control, using https://dotnetfiddle.net/, I get 292 ms using C#10 and 357 using C#13 so yes a bit of an increase but by no means, a factor 3.

I think I've seen another blog talking about it but I have lost it, I thought a minimal reproducible example with no input parsing would help find the root cause.

Теги .net, c#

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский JasonMendoza2008 2025-07-15 20:38:45 6
en5 Английский JasonMendoza2008 2025-07-15 17:23:41 3
en4 Английский JasonMendoza2008 2025-07-15 17:23:29 3 Tiny change: ' and [357 using C#1' -> ' and [357 ms using C#1'
en3 Английский JasonMendoza2008 2025-07-15 17:23:07 61
en2 Английский JasonMendoza2008 2025-07-15 17:21:08 23 Tiny change: 'ing about it but I hav' -> 'ing about C#13 being weirdly slow but I hav'
en1 Английский JasonMendoza2008 2025-07-15 17:20:13 960 Initial revision (published)