Skip allocation of SingleCallContinuation when ThrowExceptions = false - #4207
#4207Merged
304NotModified merged 1 commit intoDec 28, 2020
NLog:masterNLog/NLog:masterfrom
snakefoot:simplewithcontinuationsnakefoot/NLog:simplewithcontinuationCopy head branch name to clipboard
Merged
Skip allocation of SingleCallContinuation when ThrowExceptions = false#4207304NotModified merged 1 commit intoNLog:masterNLog/NLog:masterfrom snakefoot:simplewithcontinuationsnakefoot/NLog:simplewithcontinuationCopy head branch name to clipboard
304NotModified merged 1 commit into
NLog:masterNLog/NLog:masterfrom
snakefoot:simplewithcontinuationsnakefoot/NLog:simplewithcontinuationCopy head branch name to clipboard
Conversation
snakefoot
force-pushed
the
simplewithcontinuation
branch
from
December 17, 2020 21:31
7d2bf9a to
9442578
Compare
|
Kudos, SonarCloud Quality Gate passed! |
Member
|
cool! |
snakefoot
added a commit
that referenced
this pull request
Jan 21, 2021
* fix: generate legal json for keys that contain quote (#4202) * Improved 4.7.6 Changelog (#4205) * Skip allocation of SingleCallContinuation when ThrowExceptions = false (#4207) * StringBuilderExt ClearBuilder with better handling of low memory * ReusableObjectCreator - Added fallback logic to repair internal pool state * Travis dist changed to xenial * Added ExcludeEmptyProperties to JsonLayout. along with unit tests. * Avoid lookup CurrentProcessFilePath on Android platform * JsonLayout - Unwind after invalid property value to avoid invalid Json * Version 4.7.7 (#4257) * Version 4.7.7 Co-authored-by: Rolf Kristensen <snakefoot@users.noreply.github.com> Co-authored-by: Virgil Palanciuc <47669377+virgilp@users.noreply.github.com> Co-authored-by: Pablo Ruiz <pablo.ruiz@gmail.com> Co-authored-by: Julian Verdurmen <304NotModified@users.noreply.github.com>
Contributor
Author
|
When I tested with NetCoreApp3.1 and compared NLog 4.6.8 with NLog 4.7.7 then it reduced memory-allocation with 20 pct. When I tested with Net5.0 and compared NLog 4.6.8 with NLog 4.7.7 then it reduced memory-allocation with 10 pct. Somehow Net5.0 was able to optimize away some of the delegate-allocation in NLog 4.6.8, so the optimization in NLog 4.7.7 had less impact. |
This was referenced Sep 2, 2025
This was referenced Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should reduce NLog memory allocations a lot. Instead of allocating 3 objects (LogEventInfo + SingleCallContinuation + SingleCallContinuation.Function-delegate-instance) then it will just be the actual LogEventInfo.
Also a small bonus speed optimization on many-core-machines, as it can skip an interlocked-operation for every logevent (skip unnecessary cpu-cache synchronization).