-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test allocations #75171
Test allocations #75171
Conversation
Continuing to work on unnecessary allocations in our unit tests
@@ -12384,7 +12384,7 @@ void binaryOperator(string op, string leftType, string rightType, string expecte | |||
|
|||
if (expectedDiagnostics.Length == 0) | |||
{ | |||
CompileAndVerify(comp); | |||
CompileAndVerify(comp, emitOptions: EmitOptions.Default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default CompileAndVerify
embeds portable PDBs and the sheer number of tests here was causing that allocate 100MB of unnecessary byte[]
.
@@ -13,6 +13,7 @@ | |||
using System.IO; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Runtime.InteropServices; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a significant source of redundant byte[]
allocations.
/// <summary> | ||
/// This is the full set of references provided by default on the .NET Framework TFM | ||
/// </summary> | ||
/// <remarks> | ||
/// Need to special case tuples until we move to net472 | ||
/// </remarks> | ||
public static ImmutableArray<MetadataReference> References { get; } = [.. Net461.References.All, Net461.ExtraReferences.SystemValueTuple]; | ||
public static ImmutableArray<MetadataReference> References |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a number of tests that call say NetFramework.mscorlib
. When this was a static initializer that realized all these values when they didn't really need to be. This is only a savings in certain silces of our tests but it's a significant one in them.
@dotnet/roslyn-compiler PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 2)
Continuing to work on unnecessary allocations in our unit tests