Skip to content
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

NativeRuntimeEventSource is too slow initialized #60963

Closed
iSazonov opened this issue Oct 28, 2021 · 6 comments
Closed

NativeRuntimeEventSource is too slow initialized #60963

iSazonov opened this issue Oct 28, 2021 · 6 comments
Labels
area-System.Diagnostics.Tracing tenet-performance Performance related issue untriaged New issue has not been triaged by the area owner

Comments

@iSazonov
Copy link
Contributor

We have moved PowerShell 7.2 RC to latest pre-RTM .Net 6.0 build and I see 20% perf win in startup scenario vs PowerShell 7.1 based on .Net 5.0. Thanks .Net team for great work!

Nevertheless I still see in PerfView that System.Diagnostics.Tracing.NativeRuntimeEventSource::.cctor() is noticeable slow - in my test it is 12% in PowerShell startup scenario. (Trace file PerfViewData-7.2-Startup-Exit.speedscope.json.zip )
It seems a root of the issue System.Attribute::GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean) is slow.

There is related issue #44713. Too bad it wasn't fixed in the #45121. :-(

@iSazonov iSazonov added the tenet-performance Performance related issue label Oct 28, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Diagnostics.Tracing untriaged New issue has not been triaged by the area owner labels Oct 28, 2021
@ghost
Copy link

ghost commented Oct 28, 2021

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
See info in area-owners.md if you want to be subscribed.

Issue Details

We have moved PowerShell 7.2 RC to latest pre-RTM .Net 6.0 build and I see 20% perf win in startup scenario vs PowerShell 7.1 based on .Net 5.0. Thanks .Net team for great work!

Nevertheless I still see in PerfView that System.Diagnostics.Tracing.NativeRuntimeEventSource::.cctor() is noticeable slow - in my test it is 12% in PowerShell startup scenario. (Trace file PerfViewData-7.2-Startup-Exit.speedscope.json.zip )
It seems a root of the issue System.Attribute::GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean) is slow.

There is related issue #44713. Too bad it wasn't fixed in the #45121. :-(

Author: iSazonov
Assignees: -
Labels:

area-System.Diagnostics.Tracing, tenet-performance, untriaged

Milestone: -

@stephentoub
Copy link
Member

stephentoub commented Oct 28, 2021

There's a catch-22 here: the costs you're seeing mostly only show up as part of running a trace, as it's the act of enabling ETW that's causing the EventSource to generate and output its manifest, which in turn is what's triggering it to use reflection to walk itself. So these costs generally don't show up in real usage and only appear because you're looking at it.

The answer here isn't to try to make getting attributes faster, it's to avoid needing to do it at all. #49659 tracks that.
Also #43390.

@iSazonov
Copy link
Contributor Author

PowerShell uses System.Diagnostics.Tracing at startup too and I hope it can benefit if GetCustomAttributes will be faster.
I doubt that it is possible to completely avoid dependence on custom attributes in PowerShell but I hope we will benefit directly and indirectly from source generators in the area too.

@stephentoub
Copy link
Member

PowerShell uses System.Diagnostics.Tracing at startup too and I hope it can benefit if GetCustomAttributes will be faster.

Do you mean it has its own EventSource? That would be covered by an EventSource source generator as well.

@iSazonov
Copy link
Contributor Author

Yes, 3 at least. And yes, I hope PowerShell could benefit from source generators.

@stephentoub
Copy link
Member

Right. That's covered by the other issues. I'll close this then.

@dotnet dotnet locked as resolved and limited conversation to collaborators Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Diagnostics.Tracing tenet-performance Performance related issue untriaged New issue has not been triaged by the area owner
Development

No branches or pull requests

2 participants