Skip to content

Cross-gen more assemblies to improve startup #3638

@lzybkr

Description

@lzybkr

When running a very simple scenario like powershell -noprofile -command "echo 1", PowerShell on .Net Core is much slower than Windows PowerShell.

On my machine, in Windows PowerShell, this scenarios is 330ms, on .Net Core, it's 1380ms.

After analyzing the performance, cross-gen will help quite a bit, here are all assemblies with >5ms of JIT time at startup:

Assembly JitTime msec Num Methods IL Size Native Size
System.Linq.Expressions.dll 236.0 592 40,518 117,732
System.Management.Automation.dll 70.5 59 14,596 42,074
Microsoft.CSharp.dll 64.3 88 14,500 51,248
System.Runtime.Extensions.dll 63.1 181 9,059 41,329
System.Linq.dll 55.6 96 5,873 22,785
System.Private.CoreLib.ni.dll 52.0 139 9,756 21,120
System.Collections.Concurrent.dll 49.0 82 7,752 21,467
System.Collections.dll 43.5 106 6,329 13,983
Newtonsoft.Json.dll 38.2 67 7,552 18,844
System.IO.FileSystem.dll 26.5 75 4,356 12,125
System.Diagnostics.Process.dll 24.5 30 3,144 7,746
System.Threading.Tasks.Parallel.dll 20.2 30 3,466 9,483
System.Security.AccessControl.dll 20.1 45 4,215 10,367
System.Text.Encoding.CodePages.dll 17.5 32 4,034 10,010
System.Private.Uri.dll 12.4 26 4,229 8,563
System.Threading.dll 12.2 9 1,966 5,419
System.Security.Principal.Windows.dll 11.5 26 2,227 6,602
System.Console.dll 9.5 34 1,213 3,840
Microsoft.Win32.Registry.dll 8.2 18 2,045 4,814
System.IO.Pipes.dll 6.0 13 883 2,369
System.Diagnostics.FileVersionInfo.dll 5.3 10 1,011 2,523
System.Collections.Specialized.dll 5.2 13 507 2,263

Note that some of these methods can't be compiled ahead of time, e.g. dynamic methods or some generic methods in System.Management.Automation.dll. Still - if we cross-gen'd most of these, startup would be more similar to Windows PowerShell.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions