-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Reduce EventListener overheads #51822
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
Conversation
|
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue Details
Net result: save 2 object allocations when writing events with no payload, save some cycles in all cases
|
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Show resolved
Hide resolved
noahfalk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MihaZupan, looks good to me aside from tweaking the comment
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Outdated
Show resolved
Hide resolved
|
Thanks for the perf improvements @MihaZupan! |
object[]andReadOnlyCollectionfor theEventWrittenEventArgspayloadWriteEventWithRelatedActivityIdCore, avoid fetching metadata fromm_eventData[eventId]multiple timesDecodeObject, remove theconst bool m_EventSourcePreventRecursion = falseand the logic around flipping am_EventSourceInDecodeObjectThreadStatic we would always ignore because ofm_EventSourcePreventRecursionanywayDecodeObjectitself, pass it in instead (so we don't re-fetch metadata for each parameter)WriteToAllListeners, do it once and store the value inEventMetadata(EventListenerParameterCount)Net result: save 2 object allocations when writing events with no payload, save some cycles in all cases
Benchmark.cs