-
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
85% of pre-Main startup with VS open is Runtime/Native EventSource constructors #49592
Comments
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue DetailsFor this minimal program it takes 282ms to start running using System;
Console.WriteLine("Press a key to exit");
Console.ReadKey(); 86% (246ms) of that is the DataAnalysisThe majority of the time is All three are fixed data; however generated using reflection, The manifests and pipe events are byte arrays so could be created as The Event Descriptors also could be generated as regular
|
@benaadams, I realize it's a catch-22 from a measurement perspective, but the times you've cited are only when profiling, right? On my machine, a console app .exe created from |
85% of that is probably still the EventSource constructors, so ~76ms? 🤔 |
I suspect not. I think the EventSource times are significantly increased with the profiler attached because it's forcing them to do work they wouldn't otherwise do if the events weren't enabled. |
Does also depend if |
Either VS shouldn't register a system-wide event listener from just having a .NET project open (it adds two more when debugging #45059 (comment) so isn't that); or it should be much faster since it effects the activation of every .NET (5?) app regardless of whether its the one open in VS. |
why so many dotnet.exe's 🤔 |
dependencies in the project tree its building/checking to build |
@benaadams, question for you. Did you happen to have the VS performance tools open when you saw this, or was this just the result of having a VS window open? |
Just VS open; must also have a .NET project loaded however, doesn't register if its just open |
More specifically it looks to be "Microsoft-VisualStudio-Telemetry-PerfWatson2"
3rd provider |
Does look like I could opt out of the "Visual Studio Customer Experience Improvement Program" to disable it; but I'd assume its preferred to stay in... 😉 |
Totally. Reaching out to the VS folks on this, and will report back. |
We're working with the VS folks to reduce the scope of the tracing from PerfWatson to just the devenv process. @sywhang is also working on a source generator for EventSource, though the initial scope of that will just be for the ones in System.Private.CoreLib. That's covered by #49659, and builds on the work you did, @benaadams. Is there anything further highlighted in this issue to be addressed? Thanks! |
No, those should address it |
Closing this issue since the outstanding runtime work is tracked #49659, and the VS PerfWatson investigation is being tracked internally. Please feel free to let us know if we should re-activate. |
If Visual Studio is open on a .NET project; it registers for verbose .NET events #45059 (comment), causing all .NET programs system-wide to take additional time to start-up due to the additional Windows Etw time in the EventSource constructors.
For this minimal program it takes 282ms to start running
Main
and 300ms to get toConsole.ReadKey
(current 6.0main
branch)86% (246ms) of that is the
RuntimeEventSource
constructor.Data
Analysis
The majority of the time is
RuntimeEventSource
activatingNativeEventSource
and in there the majority is creating Manifests, Descriptors and Pipe Events.All three are fixed data; however generated using reflection,
StringBuilder
andEncoding.UTF8
during startup.The manifests and pipe events are byte arrays so could be created as
ReadOnlySpan<byte>
data sections by source generators.The Event Descriptors also could be generated as regular
new
statements with source generators rather than using runtime reflection.The text was updated successfully, but these errors were encountered: