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

Shrink Position enum #590

Closed
wants to merge 4 commits into from
Closed

Shrink Position enum #590

wants to merge 4 commits into from

Conversation

bitfaster
Copy link
Owner

@bitfaster bitfaster commented May 17, 2024

This enables better packing (thus lower memory usage) if key/value is smaller than 8 bytes on 64bit platforms. Common case is not affected, but those with irregular key/value sizes may benefit.

It is also possible to completely eliminate this enum, and instead compare the list property to the known lists inside ConcurrentLfuCore.

Baseline

Method Runtime Mean Error StdDev Ratio
ConcurrentDictionary .NET 6.0 7.944 ns 0.0667 ns 0.0557 ns 1.00
ConcurrentLfuBackground .NET 6.0 27.557 ns 0.5801 ns 1.0896 ns 3.44
ConcurrentLfuForeround .NET 6.0 57.404 ns 0.1683 ns 0.1492 ns 7.22
ConcurrentLfuThreadPool .NET 6.0 41.997 ns 0.5315 ns 0.4971 ns 5.29
ConcurrentLfuNull .NET 6.0 24.297 ns 0.1353 ns 0.1200 ns 3.06
ConcurrentDictionary .NET Framework 4.8 13.707 ns 0.0700 ns 0.0621 ns 1.00
ConcurrentLfuBackground .NET Framework 4.8 56.628 ns 0.7347 ns 0.6873 ns 4.13
ConcurrentLfuForeround .NET Framework 4.8 95.289 ns 0.2929 ns 0.2597 ns 6.95
ConcurrentLfuThreadPool .NET Framework 4.8 40.305 ns 0.8291 ns 0.9547 ns 2.94
ConcurrentLfuNull .NET Framework 4.8 34.564 ns 0.3628 ns 0.3394 ns 2.52

With shrink

Method Runtime Mean Error StdDev Ratio
ConcurrentDictionary .NET 6.0 8.091 ns 0.0829 ns 0.0648 ns 1.00
ConcurrentLfuBackground .NET 6.0 28.207 ns 0.5728 ns 1.4990 ns 3.48
ConcurrentLfuForeround .NET 6.0 56.360 ns 0.4775 ns 0.4233 ns 6.97
ConcurrentLfuThreadPool .NET 6.0 47.918 ns 0.4211 ns 0.3939 ns 5.93
ConcurrentLfuNull .NET 6.0 23.935 ns 0.2700 ns 0.2526 ns 2.96
ConcurrentDictionary .NET Framework 4.8 13.765 ns 0.1813 ns 0.1607 ns 1.00
ConcurrentLfuBackground .NET Framework 4.8 58.609 ns 0.6275 ns 0.5870 ns 4.26
ConcurrentLfuForeround .NET Framework 4.8 93.688 ns 0.5476 ns 0.4855 ns 6.81
ConcurrentLfuThreadPool .NET Framework 4.8 40.825 ns 0.4277 ns 0.3571 ns 2.96
ConcurrentLfuNull .NET Framework 4.8 36.484 ns 0.3089 ns 0.2889 ns 2.65

@coveralls
Copy link

coveralls commented May 17, 2024

Coverage Status

coverage: 99.209%. remained the same
when pulling 96b8e77 on users/alexpeck/pos
into 85a14e4 on main.

@bitfaster
Copy link
Owner Author

Superseded by #621.

@bitfaster bitfaster closed this Sep 15, 2024
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