-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[dotnet] Inline calls of internal logging #16415
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
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
Do we have performance numbers justifying this change?
1 nanosecond? :) |
User description
💥 What does this PR do?
This pull request optimizes the logging methods in the
Logger
class for better performance by applying aggressive inlining. This can help reduce the overhead of method calls, especially for frequently used logging operations.🔧 Implementation Notes
Performance improvements:
[MethodImpl(MethodImplOptions.AggressiveInlining)]
to all public logging methods (Trace
,Debug
,Info
,Warn
,Error
) and internal methods (IsEnabled
,LogMessage
) inLogger.cs
to encourage the compiler to inline these methods for faster execution.System.Runtime.CompilerServices
inLogger.cs
to support the use of theMethodImpl
attribute.PR Type
Enhancement
Description
Applied aggressive inlining to all public logging methods (
Trace
,Debug
,Info
,Warn
,Error
)Added aggressive inlining to internal helper methods (
IsEnabled
,LogMessage
)Imported
System.Runtime.CompilerServices
namespace forMethodImpl
attribute supportDiagram Walkthrough
File Walkthrough
Logger.cs
Apply aggressive inlining to Logger methods
dotnet/src/webdriver/Internal/Logging/Logger.cs
[MethodImpl(MethodImplOptions.AggressiveInlining)]
attribute toall public logging methods
IsEnabled
andLogMessage
methods
System.Runtime.CompilerServices
namespace