-
Notifications
You must be signed in to change notification settings - Fork 150
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
BeginScope: support for non-serializable objects + performance improvement (20-50% cpu, 35% times less allocations) #232
Conversation
…ializable (Ex. ActionLogScope)
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
==========================================
+ Coverage 71.39% 71.82% +0.43%
==========================================
Files 6 7 +1
Lines 374 433 +59
Branches 88 106 +18
==========================================
+ Hits 267 311 +44
- Misses 72 80 +8
- Partials 35 42 +7
Continue to review full report at Codecov.
|
…lection across all NLogLogger-objects (Reduce allocation and better cache reuse).
f641ba7
to
38f4407
Compare
… (Without CaptureMessageTemplates)
f9d8619
to
9e8395d
Compare
Simple test with the following code (Pure NetCore-console, no Asp.Net.Core)
|
@snakefoot could you please check the better code hub results? (don;t know if you could reed the results, here as image:) Thanks! |
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.
(please check better code hub)
@304NotModified Think you need to post some more screenshots. Or commit some changes to this PR that fixes the "problems". |
only "NLogLogger.CreateLogEventInfo" needs to be fixed, it has 11 branch points, and the it should be <10. So we need a helper method for that |
You are very welcome implement such a method.
Think the code is very compact already. More nesting will hide what is going on
|
I can't push on your master AFAIK. (it works on other branches) |
I think your master is protected. Any way, will make a PR then |
-- > snakefoot#5 |
b86da07
to
6ace912
Compare
@304NotModified Have now tried to reduce the complexity even further. But still it complains. Where is the pain? |
in at least |
I think we have to move some code in the future, e.g. to c# extensions I like refactoring, so I have no problem is doing that |
but you can't check the report at all? That's strange. |
merged, thanks also for refactoring! |
Found some stuff to cleanup: #233 |
Improves the support of custom objects together with BeginScope, when using AppDomains (Using CallContext that requires serializable objects)
Ex. ActionLogScope. Attempt to resolve NLog/NLog#2812
Includes a small performance boost in handling of Microsofts internal
ActionLogScope
+HostingLogScope
+FormattedLogValue
by using IReadOnlyList in the fast-path of BeginScope. (Still supports Arrays and Lists), so it doesn't allocate yield-enumerator or uses keyvaluepair-property-extractor.Includes a small performance boost by reusing a shared allocation of NLogBeginScopeParser (lives on the NLogLoggerProvider) for all NLogLogger-objects.
Includes a small performance boost in handling of log-message with no message-properties, by skipping allocation of message-property parser.
Includes a new IncludeScopes option (similar to the one for the Microsoft ConsoleLogger), that allows one to disable the overhead of the BeginScope handling (Skips parsing state and maintaining NDLC + MDLC)
Includes a small performance boost when using
CaptureMessageProperties = true
, but withCaptureMessageTemplates = false
. Then it skips extra parsing of message properties to see if making use of message-template-syntax (or positional format args)Improves the handling of
BeginScope("Hello {world}", "Earth")
so it only includes the actually property (and not the original beginscope-message-template).Improves the behavior of
BeginScope
so the returnedIDisposable
hasToString()
that returns input-stateToString()
.