Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Skip allocation of SingleCallContinuation when ThrowExceptions = false - #4207

#4207
Merged
304NotModified merged 1 commit into
NLog:masterNLog/NLog:masterfrom
snakefoot:simplewithcontinuationsnakefoot/NLog:simplewithcontinuationCopy head branch name to clipboard
Dec 28, 2020
Merged

Skip allocation of SingleCallContinuation when ThrowExceptions = false#4207
304NotModified merged 1 commit into
NLog:masterNLog/NLog:masterfrom
snakefoot:simplewithcontinuationsnakefoot/NLog:simplewithcontinuationCopy head branch name to clipboard

Conversation

@snakefoot

@snakefoot snakefoot commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

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).

@snakefoot snakefoot added this to the 4.7.7 milestone Dec 17, 2020
@snakefoot
snakefoot force-pushed the simplewithcontinuation branch from 7d2bf9a to 9442578 Compare December 17, 2020 21:31
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@304NotModified

Copy link
Copy Markdown
Member

cool!

@304NotModified
304NotModified merged commit 6a2b5b7 into NLog:master Dec 28, 2020
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>
@snakefoot

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.