Skip to content

Developers can observe notable performance improvements in MemoryCache #46970

Closed
@jeffhandley

Description

@jeffhandley

With a collection of changes that were identified through profiling, we can gain as much as +15% RPS for the TechEmpower Cached Queries benchmark.

Product improvements

Benchmark improvements

Proof of concept

Bugs Introduced

Microbenchmark results

Source

Method Runtime Mean Ratio Allocated
GetHit .NET 5.0 167.73 ns 1.00 -
GetHit .NET 6.0 112.15 ns 0.67 -
TryGetValueHit .NET 5.0 163.23 ns 1.00 -
TryGetValueHit .NET 6.0 103.77 ns 0.64 -
GetMiss .NET 5.0 115.63 ns 1.00 -
GetMiss .NET 6.0 90.21 ns 0.78 -
TryGetValueMiss .NET 5.0 116.12 ns 1.00 -
TryGetValueMiss .NET 6.0 92.80 ns 0.80 -
SetOverride .NET 5.0 394.62 ns 1.00 424 B
SetOverride .NET 6.0 286.34 ns 0.73 224 B
CreateEntry .NET 5.0 390.19 ns 1.00 424 B
CreateEntry .NET 6.0 76.73 ns 0.20 224 B
AddThenRemove_NoExpiration .NET 5.0 61,943.36 ns 1.00 60,546 B
AddThenRemove_NoExpiration .NET 6.0 53,270.07 ns 0.86 54,674 B
AddThenRemove_AbsoluteExpiration .NET 5.0 70,461.50 ns 1.00 73,331 B
AddThenRemove_AbsoluteExpiration .NET 6.0 55,862.63 ns 0.79 54,290 B
AddThenRemove_RelativeExpiration .NET 5.0 66,384.71 ns 1.00 61,026 B
AddThenRemove_RelativeExpiration .NET 6.0 49,905.29 ns 0.75 33,889 B
AddThenRemove_SlidingExpiration .NET 5.0 70,597.44 ns 1.00 74,099 B
AddThenRemove_SlidingExpiration .NET 6.0 49,301.41 ns 0.70 40,017 B
AddThenRemove_ExpirationTokens .NET 5.0 72,186.78 ns 1.00 71,771 B
AddThenRemove_ExpirationTokens .NET 6.0 65,962.42 ns 0.91 66,490 B

Metadata

Metadata

Labels

Bottom Up WorkNot part of a theme, epic, or user storyCost:SWork that requires one engineer up to 1 weekPriority:3Work that is nice to haveUser StoryA single user-facing feature. Can be grouped under an epic.area-Extensions-Cachingtenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions