Skip to content

Conversation

@AndyAyersMS
Copy link
Member

RyuJit would not inline methods that contained delegate invokes. Remove
this limitation.

Closes #10048. See also #37941.

RyuJit would not inline methods that contained delegate invokes. Remove
this limitation.

Closes dotnet#10048. See also dotnet#37941.
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 26, 2020
@AndyAyersMS
Copy link
Member Author

@erozenfeld PTAL cc @dotnet/jit-contrib

jit-diffs shows small size increase, most prominently from methods in the command line parser that are marked with aggressive inlining.

PMI CodeSize Diffs for System.Private.CoreLib.dll, framework assemblies for x64 default jit
Summary of Code Size diffs:
(Lower is better)
Total bytes of diff: 30147 (0.064% of base)
    diff is a regression.
Top file regressions (bytes):
       13367 : CommandLine.dasm (3.039% of base)
        3272 : Microsoft.CodeAnalysis.dasm (0.189% of base)
        2144 : System.Management.dasm (0.554% of base)
        2091 : Microsoft.Diagnostics.Tracing.TraceEvent.dasm (0.069% of base)
        1932 : System.Private.Xml.dasm (0.054% of base)
        1252 : Microsoft.CodeAnalysis.VisualBasic.dasm (0.022% of base)
        1134 : System.Net.Sockets.dasm (0.577% of base)
         650 : System.Threading.Tasks.Dataflow.dasm (0.077% of base)
         498 : Newtonsoft.Json.dasm (0.057% of base)
         465 : System.Data.Common.dasm (0.031% of base)
         449 : Microsoft.CodeAnalysis.CSharp.dasm (0.010% of base)
         380 : System.Private.CoreLib.dasm (0.008% of base)
         342 : xunit.execution.dotnet.dasm (0.147% of base)
         295 : Microsoft.Extensions.Primitives.dasm (1.124% of base)
         233 : System.Runtime.Serialization.Formatters.dasm (0.242% of base)
         215 : System.Security.Cryptography.Primitives.dasm (0.616% of base)
         200 : System.Private.DataContractSerialization.dasm (0.026% of base)
         193 : Microsoft.Extensions.Http.dasm (0.446% of base)
         144 : xunit.runner.utility.netcoreapp10.dasm (0.076% of base)
         112 : xunit.console.dasm (0.129% of base)
36 total files with Code Size differences (0 improved, 36 regressed), 232 unchanged.
Top method regressions (bytes):
        2742 (78.253% of base) : CommandLine.dasm - Trial:Collect(IEnumerable`1):Result`2 (7 methods)
        2742 (95.540% of base) : CommandLine.dasm - ResultExtensions:Collect(IEnumerable`1):Result`2 (7 methods)
        2670 (49.739% of base) : CommandLine.dasm - ResultExtensions:Flatten(Result`2):Result`2 (7 methods)
         643 (7.180% of base) : CommandLine.dasm - HelpText:AutoBuild(ParserResult`1,Func`2,Func`2,bool,int):HelpText (7 methods)
         540 (22.213% of base) : CommandLine.dasm - Trial:Flatten(Result`2):Result`2 (7 methods)
         531 (42.277% of base) : CommandLine.dasm - Trial:MergeMessages(IEnumerable`1,Result`2):Result`2 (7 methods)
         478 (61.997% of base) : CommandLine.dasm - Tokenizer:PreprocessDashDash(IEnumerable`1,Func`2):Result`2
         399 (23.596% of base) : Microsoft.CodeAnalysis.dasm - <DescendantTriviaIntoTrivia>d__161:MoveNext():bool:this
         353 (14.143% of base) : Microsoft.CodeAnalysis.dasm - <DescendantNodesAndTokensIntoTrivia>d__159:MoveNext():bool:this
         333 (19.692% of base) : System.Private.Xml.dasm - XmlSchemaValidator:ElementValidationError(XmlQualifiedName,ValidationState,ValidationEventHandler,Object,String,int,int,XmlSchemaSet)
         324 (14.093% of base) : Microsoft.Diagnostics.Tracing.TraceEvent.dasm - TraceLog:FastSerialization.IFastSerializable.ToStream(Serializer):this
         320 (96.677% of base) : Microsoft.CodeAnalysis.dasm - CryptographicHashProvider:TryGetAlgorithm(int):HashAlgorithm (2 methods)
         294 (25.610% of base) : CommandLine.dasm - <>c__DisplayClass17_0`1:<DisplayHelp>b__0(IEnumerable`1):this (7 methods)
         284 (39.281% of base) : Microsoft.CodeAnalysis.dasm - AbstractSyntaxNavigator:GetPreviousToken(SyntaxTrivia,SyntaxTriviaList,Func`2,Func`2,byref):SyntaxToken:this
         273 (2.549% of base) : CommandLine.dasm - HelpText:AutoBuild(ParserResult`1,int):HelpText (7 methods)
         264 (49.811% of base) : Microsoft.CodeAnalysis.dasm - AbstractSyntaxNavigator:GetLastToken(SyntaxTriviaList,Func`2,Func`2):SyntaxToken:this
         232 (6.080% of base) : System.Private.CoreLib.dasm - ArraySortHelper`1:IntroSort(Span`1,int,Comparison`1) (8 methods)
         228 (11.639% of base) : System.Private.Xml.dasm - XmlWellFormedWriter:AdvanceStateAsync(int):Task:this
         220 (16.165% of base) : Microsoft.CodeAnalysis.dasm - <DescendantTriviaOnly>d__160:MoveNext():bool:this
         215 (22.142% of base) : System.Private.Xml.dasm - XmlSchemaValidator:CompleteValidationError(ValidationState,ValidationEventHandler,Object,String,int,int,XmlSchemaSet)
Top method improvements (bytes):
         -18 (-0.708% of base) : System.Net.Http.WinHttpHandler.dasm - HttpKnownHeaderNames:TryGetHeaderName(__Canon,int,int,Func`3,Func`5,byref):bool
          -4 (-0.219% of base) : CommandLine.dasm - <>c__DisplayClass0_2`1:<Build>b__15():__Canon:this
          -2 (-0.412% of base) : xunit.performance.execution.dasm - BenchmarkEventSource:BenchmarkIterationStop(String,String,int,long):this
Top method regressions (percentages):
          64 (914.286% of base) : System.Private.CoreLib.dasm - _ThreadPoolWaitOrTimerCallback:WaitOrTimerCallback_Context_f(Object)
          64 (640.000% of base) : System.Private.CoreLib.dasm - _ThreadPoolWaitOrTimerCallback:WaitOrTimerCallback_Context_t(Object)
          31 (620.000% of base) : System.Management.dasm - ManagementOptions:HandleIdentifierChange(Object,IdentifierChangedEventArgs):this
          31 (387.500% of base) : System.Management.dasm - EventWatcherOptions:set_BlockSize(int):this
          52 (288.889% of base) : System.Runtime.Serialization.Formatters.dasm - SerializationEvents:InvokeOnSerializing(Object,StreamingContext):this
          52 (288.889% of base) : System.Runtime.Serialization.Formatters.dasm - SerializationEvents:InvokeOnDeserializing(Object,StreamingContext):this
          52 (288.889% of base) : System.Runtime.Serialization.Formatters.dasm - SerializationEvents:InvokeOnDeserialized(Object,StreamingContext):this
          31 (281.818% of base) : System.Management.dasm - ManagementScope:HandleIdentifierChange(Object,IdentifierChangedEventArgs):this
          43 (215.000% of base) : Microsoft.CSharp.dasm - UnsafeMethods:IUnknownReleaseNotZero(long)
          30 (214.286% of base) : System.Management.dasm - ConnectionOptions:set_Impersonation(int):this
          30 (214.286% of base) : System.Management.dasm - ConnectionOptions:set_Authentication(int):this
          30 (136.364% of base) : System.Management.dasm - ConnectionOptions:set_EnablePrivileges(bool):this
          75 (131.579% of base) : System.Net.Sockets.dasm - SocketPal:Disconnect(Socket,SafeSocketHandle,bool):int
         116 (116.000% of base) : CommandLine.dasm - MaybeExtensions:Map(Maybe`1,Func`2):Maybe`1 (7 methods)
         116 (116.000% of base) : CommandLine.dasm - MaybeExtensions:Select(Maybe`1,Func`2):Maybe`1 (7 methods)
         320 (96.677% of base) : Microsoft.CodeAnalysis.dasm - CryptographicHashProvider:TryGetAlgorithm(int):HashAlgorithm (2 methods)
        2742 (95.540% of base) : CommandLine.dasm - ResultExtensions:Collect(IEnumerable`1):Result`2 (7 methods)
          36 (94.737% of base) : System.Management.dasm - ObjectGetOptions:set_UseAmendedQualifiers(bool):this
          90 (90.000% of base) : CommandLine.dasm - MaybeExtensions:Bind(Maybe`1,Func`2):Maybe`1 (7 methods)
          26 (89.655% of base) : System.Management.dasm - ManagementNamedValueCollection:Remove(String):this
Top method improvements (percentages):
         -18 (-0.708% of base) : System.Net.Http.WinHttpHandler.dasm - HttpKnownHeaderNames:TryGetHeaderName(__Canon,int,int,Func`3,Func`5,byref):bool
          -2 (-0.412% of base) : xunit.performance.execution.dasm - BenchmarkEventSource:BenchmarkIterationStop(String,String,int,long):this
          -4 (-0.219% of base) : CommandLine.dasm - <>c__DisplayClass0_2`1:<Build>b__15():__Canon:this
445 total methods with Code Size differences (3 improved, 442 regressed), 243053 unchanged.

@jkotas
Copy link
Member

jkotas commented Jun 27, 2020

Where is the CommandLine assembly coming from? It sounds broken to use AggressiveInlining extensively in command line parsers.

@BruceForstall
Copy link
Contributor

Where is the CommandLine assembly coming from?

It's whatever is in Core_Root:

ProductVersion  2.0.275
FileVersion     2.0.275.0
Comments        Command Line Parser Library allows CLR applications to define a syntax for parsing command line arguments.

Copy link
Member

@erozenfeld erozenfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JulieLeeMSFT JulieLeeMSFT added this to the 5.0.0 milestone Jun 27, 2020
@jkotas jkotas merged commit dd10afe into dotnet:master Jun 27, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to inline methods with delegate invocation (at least methods marked with AggressiveInlining)

6 participants