Skip to content
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

Cache low-numbered numeric event ids to reduce allocations #142

Merged
merged 2 commits into from
Aug 20, 2019

Conversation

nblumhardt
Copy link
Member

This is a quick improvement for #118. Needs a benchmark to measure allocs.

@nblumhardt nblumhardt changed the title [WIP] Cache low-numbered numeric event ids to reduce allocations Cache low-numbered numeric event ids to reduce allocations Aug 19, 2019
@nblumhardt nblumhardt mentioned this pull request Aug 19, 2019
@nblumhardt
Copy link
Member Author

Just a note, most of the framework projects now user, or will use, event ids: dotnet/aspnetcore#6381

@nblumhardt
Copy link
Member Author

Added some very basic, broad benchmarks. Shows (I think) that it's worth making this change, but also that there's a lot of opportunity still there in the allocations department.

BenchmarkDotNet=v0.11.5, OS=Windows 10.0.18362
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.2.105
  [Host]     : .NET Core 2.2.6 (CoreCLR 4.6.27817.03, CoreFX 4.6.27818.02), 64bit RyuJIT
  DefaultJob : .NET Core 2.2.6 (CoreCLR 4.6.27817.03, CoreFX 4.6.27818.02), 64bit RyuJIT
Method Mean Error StdDev Ratio RatioSD Gen 0 Gen 1 Gen 2 Allocated
Native 381.0 ns 41.01 ns 48.82 ns 1.00 0.00 0.0887 - - 280 B
NoId 1,004.2 ns 10.84 ns 10.14 ns 2.63 0.34 0.2785 - - 880 B
LowNumbered 1,367.0 ns 37.37 ns 104.80 ns 3.49 0.48 0.3529 - - 1112 B
HighNumbered 1,378.5 ns 27.65 ns 77.08 ns 3.67 0.43 0.3777 - - 1192 B

@adamchester adamchester merged commit 11c3c07 into serilog:dev Aug 20, 2019
@nblumhardt nblumhardt added this to the 3.0.0 milestone Aug 20, 2019
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.

2 participants