-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Slow AssemblyLoadContext.StartAssemblyLoad() at startup #45466
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @CoffeeFlux Issue DetailsDescriptionRelated #44598 The StartAssemblyLoad() initializes tracing Lines 199 to 206 in 191ea06
Especially the slow System.Threading.Tasks.TplEventSource..cctor () - 49 ms (8.5%). We can't seem to improve this in PowerShell and I hope it will be improved in .Net in some way. Perhaps it is possible to postpone the initialization or make it async. ConfigurationUsed PowerShell 7.2 Preview.1 based on .Net 5.0.
|
EventSource construction is relatively expensive reflection heavy operation today. The ultimate way to fix this overhead is to replace the reflection with source generators: #43390 |
In the my trace for startup scenario it seems a reflection calls take <0.8% but System.Resources.ResourceManager.GetString() 1.2%. |
Looking at the stacktrace It's the manifest generation; Source generators should still help here. |
Related to #45518 |
Description
Related #44598
I measured PowerShell startup scenario with
pwsh -c exit
(really start-stop scenario).One delay in the scenario is in AssemblyLoadContext.StartAssemblyLoad() called from hostpolicy - 59 ms (10%).
The StartAssemblyLoad() initializes tracing
runtime/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs
Lines 199 to 206 in 191ea06
Especially the slow System.Threading.Tasks.TplEventSource..cctor () - 49 ms (8.5%).
(And System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor() too)
We can't seem to improve this in PowerShell and I hope it will be improved in .Net in some way. Perhaps it is possible to postpone the initialization or make it async.
Configuration
Used PowerShell 7.2 Preview.1 based on .Net 5.0.
The text was updated successfully, but these errors were encountered: