Closed
Description
Description
One of our tests started to run ~20x slower on .NET 9 RC1, if it's compiled in Debug configuration.
That's where it spends most of its time:
There is another branch with similar ~38%, and it's also on the same ThreadRandom.get_Instance
call.
ThreadRandom
looks as follows:
public static class ThreadRandom
{
[ThreadStatic] private static Random? _instance;
public static Random Instance {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _instance ??= CreateInstance();
}
private static Random CreateInstance()
=> new(Random.Shared.Next());
}
What's weird is that all of my attempts to reproduce this perf. regression on isolated console app failed, even though a console app running the code of this specific unit test also manifests the regression.
Configuration
Windows 11 machine.
Regression?
Yes, it looks like this is a perf. regression.
Data
No additional data.
Analysis
Not sure what it could be.