Skip to content

perf in LogMessage#4453

Closed
SimonCropp wants to merge 11 commits intomicrosoft:mainfrom
SimonCropp:perf-in-LogMessage
Closed

perf in LogMessage#4453
SimonCropp wants to merge 11 commits intomicrosoft:mainfrom
SimonCropp:perf-in-LogMessage

Conversation

@SimonCropp
Copy link
Copy Markdown
Contributor

@SimonCropp SimonCropp commented Dec 26, 2024

I assume logging is in the hot path. so a few more lines for better oerf is justified

move over to using EnumerateInvocationList

@Evangelink
Copy link
Copy Markdown
Member

Evangelink commented Dec 28, 2024

I have synced the Polyfill package.

@Youssef1313
Copy link
Copy Markdown
Member

Youssef1313 commented Dec 29, 2024

@Evangelink We need to add the updated version to https://github.com/dotnet/source-build-reference-packages/tree/main/src/textOnlyPackages/src/polyfill/

I'll take care of that.

@Youssef1313
Copy link
Copy Markdown
Member

I opened dotnet/source-build-reference-packages#1105
@SimonCropp It may take a while to get that PR merged due to holidays.

object?[] parameters = [message];
// Making sure all event handlers are called in sync on same thread.
foreach (Delegate invoker in OnLogMessage.GetInvocationList())
foreach (LogMessageHandler invoker in DelegatePolyfill.EnumerateInvocationList(OnLogMessage))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we don't call Logger.LogMessage at all. I don't know how much consumers will be calling this, but it doesn't seem to be a hot path.

@Evangelink I'm not sure if there are "valid" use cases for this Logger class or not. If not, we should consider breaking in v4.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Youssef1313 want me to burn this PR, and submit another that marks it as obsolete?

Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let @Evangelink answer that on whether there are valid use cases for Logger.LogMessage or if people are using that API

@SimonCropp SimonCropp closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants