Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

JasonMendoza2008's blog

By JasonMendoza2008, history, 16 months ago, In English

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);
    }
}

On codeforces, 358 ms with C#10, and 1030 ms with C#13.

As a control, using https://dotnetfiddle.net/, I get 292 ms using C#10 and 357 ms 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 C#13 being weirdly slow but I have lost it, I thought a minimal reproducible example with no input parsing would help find the root cause.

Tags .net, c#
  • Vote: I like it
  • +9
  • Vote: I do not like it