-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
area-System.LinqenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Currently System.Linq uses this pattern to handle invalid arguments:
if (source == null)
{
throw Error.ArgumentNull(nameof(source));
}
Where ArgumentNull
gets inlined. This introduces significant jitted code bloat since the Linq methods are generic, so this code (which very rarely gets hit) is generated over and over again for different value types.
We should convert all of this to the form
if (source == null)
{
Error.ThrowSourceArgumentNull(); // or ThrowArgumentNullSource
}
As of dotnet/coreclr#6103 methods that are known to throw are not inlined, so this should help decrease code size.
cc @benaadams
Metadata
Metadata
Assignees
Labels
area-System.LinqenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors