Skip to content

perf #174

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

Merged
merged 5 commits into from
Jul 28, 2022
Merged

perf #174

merged 5 commits into from
Jul 28, 2022

Conversation

bitfaster
Copy link
Owner

@bitfaster bitfaster commented Jul 28, 2022

Inheriting from IBoundedPolicy/ITimePolicy comes with some overhead, so use proxy. Caching an instance of proxy inside lru core also results in the same penalty.

Before:

Method Runtime Mean Error Ratio Code Size Allocated
ConcurrentDictionary .NET 6.0 7.368 ns 0.0568 ns 1.00 1,523 B -
FastConcurrentLru .NET 6.0 10.248 ns 0.2043 ns 1.39 2,352 B -
ConcurrentLru .NET 6.0 13.693 ns 0.1725 ns 1.86 2,378 B -
AtomicFastLru .NET 6.0 19.988 ns 0.1546 ns 2.71 846 B -
FastConcurrentTLru .NET 6.0 26.544 ns 0.3709 ns 3.61 2,544 B -
ConcurrentTLru .NET 6.0 32.986 ns 0.3864 ns 4.48 2,619 B -
ClassicLru .NET 6.0 48.563 ns 0.3721 ns 6.60 3,041 B -
RuntimeMemoryCacheGet .NET 6.0 121.734 ns 2.3760 ns 16.60 49 B 32 B
ExtensionsMemoryCacheGet .NET 6.0 53.987 ns 0.4352 ns 7.33 78 B 24 B
ConcurrentDictionary .NET Framework 4.8 14.333 ns 0.2964 ns 1.00 4,207 B -
FastConcurrentLru .NET Framework 4.8 15.140 ns 0.2779 ns 1.06 15,182 B -
ConcurrentLru .NET Framework 4.8 17.627 ns 0.3523 ns 1.23 15,212 B -
AtomicFastLru .NET Framework 4.8 39.460 ns 0.7806 ns 2.76 358 B -
FastConcurrentTLru .NET Framework 4.8 45.415 ns 0.5684 ns 3.17 15,358 B -
ConcurrentTLru .NET Framework 4.8 47.494 ns 0.7391 ns 3.31 15,403 B -
ClassicLru .NET Framework 4.8 61.447 ns 0.8935 ns 4.28 6,945 B -
RuntimeMemoryCacheGet .NET Framework 4.8 282.429 ns 3.1541 ns 19.72 33 B 32 B
ExtensionsMemoryCacheGet .NET Framework 4.8 114.503 ns 1.4632 ns 7.99 82 B 24 B

After:

Method Runtime Mean Error Ratio Code Size Allocated
ConcurrentDictionary .NET 6.0 8.132 ns 0.1803 ns 1.00 1,523 B -
FastConcurrentLru .NET 6.0 10.059 ns 0.0674 ns 1.24 2,352 B -
ConcurrentLru .NET 6.0 13.665 ns 0.0694 ns 1.68 2,378 B -
AtomicFastLru .NET 6.0 19.910 ns 0.3562 ns 2.45 846 B -
FastConcurrentTLru .NET 6.0 25.743 ns 0.2754 ns 3.17 2,544 B -
ConcurrentTLru .NET 6.0 29.895 ns 0.0757 ns 3.68 2,619 B -
ClassicLru .NET 6.0 48.791 ns 0.8167 ns 6.01 3,041 B -
RuntimeMemoryCacheGet .NET 6.0 117.031 ns 1.9028 ns 14.44 49 B 32 B
ExtensionsMemoryCacheGet .NET 6.0 54.898 ns 1.0983 ns 6.77 78 B 24 B
ConcurrentDictionary .NET Framework 4.8 13.810 ns 0.1752 ns 1.00 4,207 B -
FastConcurrentLru .NET Framework 4.8 15.032 ns 0.3198 ns 1.09 15,182 B -
ConcurrentLru .NET Framework 4.8 17.699 ns 0.3127 ns 1.28 15,212 B -
AtomicFastLru .NET Framework 4.8 40.034 ns 0.3762 ns 2.90 358 B -
FastConcurrentTLru .NET Framework 4.8 45.270 ns 0.1457 ns 3.28 15,358 B -
ConcurrentTLru .NET Framework 4.8 46.651 ns 0.7994 ns 3.38 15,403 B -
ClassicLru .NET Framework 4.8 61.811 ns 0.8297 ns 4.47 6,945 B -
RuntimeMemoryCacheGet .NET Framework 4.8 277.511 ns 1.1883 ns 20.08 33 B 32 B
ExtensionsMemoryCacheGet .NET Framework 4.8 113.441 ns 1.1372 ns 8.21 82 B 24 B

@bitfaster bitfaster changed the title proxy perf Jul 28, 2022
@bitfaster bitfaster merged commit 4b5c32d into main Jul 28, 2022
@bitfaster bitfaster deleted the users/alexpeck/perf branch July 28, 2022 17:41
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.

1 participant