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

Optimize AVX intrinsics for .NET8 #597

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

bitfaster
Copy link
Owner

@bitfaster bitfaster commented May 27, 2024

We saw good gains from AVX on .NET6, but not on .NET8/9. Not clear whether this is dynamic PGO, and whether the benchmarks are really representative of real world performance.

2 changes here:

  • Apply MethodImpl(MethodImplOptions.AggressiveInlining)
  • Avoid declaring locals: this influences the IL/JITTed code.

As tested, this is always faster on AMD, only faster at large sizes on Intel.

TODO:

  • Verify throughput test before/after (this is more like an integration test).
  • Larger sketch sizes appear to result in smaller assembly code reported by the DisassemblyDiagnoser. Investigate whether dynamic PGO is somehow making different code for small vs large.
  • Test AggressiveOptimization (512)

Vector128<int> offset = Avx2.And(h, Vector128.Create(1));
Vector128<int> blockOffset = Avx2.Add(Vector128.Create(block), offset); // i - table index
blockOffset = Avx2.Add(blockOffset, Vector128.Create(0, 2, 4, 6)); // + (i << 1)
Vector256<ulong> indexLong = Avx2.PermuteVar8x32(Vector256.Create(index, Vector128<int>.Zero), Vector256.Create(0, 4, 1, 5, 2, 5, 3, 7)).AsUInt64();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this become readonlyspan as suggested here for the permute lookup table:

https://bits.houmus.org/2020-01-30/this-goes-to-eleven-pt3

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 21, 2024

BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2849) (Hyper-V)
AMD EPYC 7763, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4762.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX2
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2

BitFaster Caching Benchmarks Lfu SketchIncrement-columnchart

Tabular data
Method Runtime Size Mean Error StdDev Ratio Code Size Allocated
IncFlat .NET 6.0 512 19.994 ns 0.0245 ns 0.0204 ns 1.00 852 B -
IncBlock .NET 6.0 512 21.692 ns 0.0117 ns 0.0110 ns 1.08 813 B -
IncBlockAvxNotPinned .NET 6.0 512 12.645 ns 0.2610 ns 0.3301 ns 0.63 NA -
IncBlockAvxPinned .NET 6.0 512 26.612 ns 0.1795 ns 0.1679 ns 1.33 856 B -
IncFlat .NET 8.0 512 10.836 ns 0.0034 ns 0.0030 ns 1.00 1,019 B -
IncBlock .NET 8.0 512 16.449 ns 0.0089 ns 0.0084 ns 1.52 863 B -
IncBlockAvxNotPinned .NET 8.0 512 11.099 ns 0.0041 ns 0.0036 ns 1.02 NA -
IncBlockAvxPinned .NET 8.0 512 9.201 ns 0.0018 ns 0.0017 ns 0.85 865 B -
IncFlat .NET 9.0 512 10.898 ns 0.0048 ns 0.0043 ns 1.00 1,003 B -
IncBlock .NET 9.0 512 16.323 ns 0.0191 ns 0.0179 ns 1.50 852 B -
IncBlockAvxNotPinned .NET 9.0 512 10.419 ns 0.0053 ns 0.0049 ns 0.96 NA -
IncBlockAvxPinned .NET 9.0 512 9.190 ns 0.0007 ns 0.0006 ns 0.84 846 B -
IncFlat .NET 6.0 1024 21.821 ns 0.0112 ns 0.0105 ns 1.00 852 B -
IncBlock .NET 6.0 1024 21.697 ns 0.0145 ns 0.0135 ns 0.99 813 B -
IncBlockAvxNotPinned .NET 6.0 1024 12.182 ns 0.0126 ns 0.0105 ns 0.56 NA -
IncBlockAvxPinned .NET 6.0 1024 10.866 ns 0.0033 ns 0.0028 ns 0.50 856 B -
IncFlat .NET 8.0 1024 10.820 ns 0.0041 ns 0.0038 ns 1.00 1,019 B -
IncBlock .NET 8.0 1024 16.663 ns 0.0659 ns 0.0617 ns 1.54 863 B -
IncBlockAvxNotPinned .NET 8.0 1024 13.205 ns 0.2534 ns 0.2371 ns 1.22 NA -
IncBlockAvxPinned .NET 8.0 1024 9.201 ns 0.0027 ns 0.0025 ns 0.85 870 B -
IncFlat .NET 9.0 1024 10.809 ns 0.0033 ns 0.0031 ns 1.00 1,003 B -
IncBlock .NET 9.0 1024 16.345 ns 0.0072 ns 0.0068 ns 1.51 852 B -
IncBlockAvxNotPinned .NET 9.0 1024 10.736 ns 0.0047 ns 0.0044 ns 0.99 NA -
IncBlockAvxPinned .NET 9.0 1024 9.190 ns 0.0028 ns 0.0023 ns 0.85 851 B -
IncFlat .NET 6.0 32768 22.237 ns 0.0103 ns 0.0086 ns 1.00 852 B -
IncBlock .NET 6.0 32768 22.169 ns 0.4356 ns 0.7396 ns 1.00 813 B -
IncBlockAvxNotPinned .NET 6.0 32768 13.726 ns 0.0049 ns 0.0046 ns 0.62 NA -
IncBlockAvxPinned .NET 6.0 32768 25.546 ns 0.4984 ns 0.5739 ns 1.15 856 B -
IncFlat .NET 8.0 32768 11.461 ns 0.0151 ns 0.0141 ns 1.00 1,019 B -
IncBlock .NET 8.0 32768 16.623 ns 0.0073 ns 0.0065 ns 1.45 863 B -
IncBlockAvxNotPinned .NET 8.0 32768 12.285 ns 0.0245 ns 0.0229 ns 1.07 NA -
IncBlockAvxPinned .NET 8.0 32768 10.160 ns 0.0052 ns 0.0048 ns 0.89 870 B -
IncFlat .NET 9.0 32768 10.928 ns 0.0021 ns 0.0019 ns 1.00 1,003 B -
IncBlock .NET 9.0 32768 16.457 ns 0.0292 ns 0.0273 ns 1.51 852 B -
IncBlockAvxNotPinned .NET 9.0 32768 11.912 ns 0.0636 ns 0.0563 ns 1.09 NA -
IncBlockAvxPinned .NET 9.0 32768 10.313 ns 0.0039 ns 0.0035 ns 0.94 851 B -
IncFlat .NET 6.0 524288 28.688 ns 0.1017 ns 0.0951 ns 1.00 852 B -
IncBlock .NET 6.0 524288 29.529 ns 0.5559 ns 0.8148 ns 1.03 813 B -
IncBlockAvxNotPinned .NET 6.0 524288 23.579 ns 0.0655 ns 0.0613 ns 0.82 NA -
IncBlockAvxPinned .NET 6.0 524288 42.347 ns 0.3860 ns 0.3422 ns 1.48 856 B -
IncFlat .NET 8.0 524288 16.941 ns 0.0252 ns 0.0224 ns 1.00 1,017 B -
IncBlock .NET 8.0 524288 23.322 ns 0.1762 ns 0.1648 ns 1.38 863 B -
IncBlockAvxNotPinned .NET 8.0 524288 20.980 ns 0.0187 ns 0.0166 ns 1.24 NA -
IncBlockAvxPinned .NET 8.0 524288 17.241 ns 0.0092 ns 0.0082 ns 1.02 870 B -
IncFlat .NET 9.0 524288 16.787 ns 0.0256 ns 0.0213 ns 1.00 1,001 B -
IncBlock .NET 9.0 524288 22.883 ns 0.0925 ns 0.0866 ns 1.36 852 B -
IncBlockAvxNotPinned .NET 9.0 524288 20.639 ns 0.0164 ns 0.0145 ns 1.23 NA -
IncBlockAvxPinned .NET 9.0 524288 17.626 ns 0.0200 ns 0.0177 ns 1.05 851 B -
IncFlat .NET 6.0 8388608 113.295 ns 0.8086 ns 0.7563 ns 1.00 482 B -
IncBlock .NET 6.0 8388608 99.386 ns 1.2266 ns 1.1474 ns 0.88 443 B -
IncBlockAvxNotPinned .NET 6.0 8388608 60.697 ns 1.1566 ns 1.2375 ns 0.54 NA -
IncBlockAvxPinned .NET 6.0 8388608 65.679 ns 0.5005 ns 0.4682 ns 0.58 486 B -
IncFlat .NET 8.0 8388608 63.259 ns 0.3984 ns 0.3532 ns 1.00 655 B -
IncBlock .NET 8.0 8388608 60.081 ns 1.0061 ns 0.8919 ns 0.95 499 B -
IncBlockAvxNotPinned .NET 8.0 8388608 57.111 ns 0.9583 ns 0.8964 ns 0.90 NA -
IncBlockAvxPinned .NET 8.0 8388608 44.598 ns 0.4255 ns 0.3772 ns 0.71 506 B -
IncFlat .NET 9.0 8388608 64.338 ns 0.6868 ns 0.6424 ns 1.00 655 B -
IncBlock .NET 9.0 8388608 60.149 ns 1.1947 ns 1.3279 ns 0.93 504 B -
IncBlockAvxNotPinned .NET 9.0 8388608 56.705 ns 0.7925 ns 0.7025 ns 0.88 NA -
IncBlockAvxPinned .NET 9.0 8388608 45.838 ns 0.6625 ns 0.6197 ns 0.71 466 B -
IncFlat .NET 6.0 134217728 137.227 ns 1.5811 ns 1.3203 ns 1.00 482 B -
IncBlock .NET 6.0 134217728 77.231 ns 0.3735 ns 0.3493 ns 0.56 443 B -
IncBlockAvxNotPinned .NET 6.0 134217728 75.306 ns 0.5542 ns 0.5184 ns 0.55 NA -
IncBlockAvxPinned .NET 6.0 134217728 74.481 ns 0.4140 ns 0.3670 ns 0.54 486 B -
IncFlat .NET 8.0 134217728 75.169 ns 0.5829 ns 0.5453 ns 1.00 655 B -
IncBlock .NET 8.0 134217728 75.121 ns 0.9903 ns 0.9263 ns 1.00 499 B -
IncBlockAvxNotPinned .NET 8.0 134217728 71.833 ns 1.4085 ns 1.2486 ns 0.96 NA -
IncBlockAvxPinned .NET 8.0 134217728 53.279 ns 0.5386 ns 0.4775 ns 0.71 506 B -
IncFlat .NET 9.0 134217728 75.286 ns 0.2704 ns 0.2258 ns 1.00 655 B -
IncBlock .NET 9.0 134217728 74.187 ns 0.3861 ns 0.3612 ns 0.99 504 B -
IncBlockAvxNotPinned .NET 9.0 134217728 71.378 ns 0.4651 ns 0.4351 ns 0.95 NA -
IncBlockAvxPinned .NET 9.0 134217728 52.690 ns 0.4365 ns 0.3870 ns 0.70 503 B -

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 21, 2024

BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2849) (Hyper-V)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4762.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

BitFaster Caching Benchmarks Lfu SketchIncrement-columnchart

Tabular data | Method | Runtime | Size | Mean | Error | StdDev | Ratio | Code Size | Allocated | |--------------------- |--------- |---------- |----------:|---------:|---------:|------:|----------:|----------:| | IncFlat | .NET 6.0 | 512 | 23.32 ns | 0.057 ns | 0.051 ns | 1.00 | 852 B | - | | IncBlock | .NET 6.0 | 512 | 17.89 ns | 0.052 ns | 0.048 ns | 0.77 | 813 B | - | | IncBlockAvxNotPinned | .NET 6.0 | 512 | 15.91 ns | 0.040 ns | 0.033 ns | 0.68 | NA | - | | IncBlockAvxPinned | .NET 6.0 | 512 | 15.37 ns | 0.036 ns | 0.032 ns | 0.66 | 856 B | - | | | | | | | | | | | | IncFlat | .NET 8.0 | 512 | 10.31 ns | 0.011 ns | 0.009 ns | 1.00 | 1,019 B | - | | IncBlock | .NET 8.0 | 512 | 14.51 ns | 0.016 ns | 0.015 ns | 1.41 | 863 B | - | | IncBlockAvxNotPinned | .NET 8.0 | 512 | 14.22 ns | 0.010 ns | 0.009 ns | 1.38 | NA | - | | IncBlockAvxPinned | .NET 8.0 | 512 | 12.52 ns | 0.011 ns | 0.010 ns | 1.21 | 859 B | - | | | | | | | | | | | | IncFlat | .NET 9.0 | 512 | 10.07 ns | 0.012 ns | 0.010 ns | 1.00 | 1,003 B | - | | IncBlock | .NET 9.0 | 512 | 15.67 ns | 0.074 ns | 0.066 ns | 1.56 | 852 B | - | | IncBlockAvxNotPinned | .NET 9.0 | 512 | 13.64 ns | 0.006 ns | 0.006 ns | 1.35 | NA | - | | IncBlockAvxPinned | .NET 9.0 | 512 | 12.50 ns | 0.010 ns | 0.009 ns | 1.24 | 844 B | - | | | | | | | | | | | | IncFlat | .NET 6.0 | 1024 | 21.20 ns | 0.052 ns | 0.048 ns | 1.00 | 852 B | - | | IncBlock | .NET 6.0 | 1024 | 17.88 ns | 0.065 ns | 0.061 ns | 0.84 | 813 B | - | | IncBlockAvxNotPinned | .NET 6.0 | 1024 | 15.88 ns | 0.037 ns | 0.035 ns | 0.75 | NA | - | | IncBlockAvxPinned | .NET 6.0 | 1024 | 15.38 ns | 0.031 ns | 0.029 ns | 0.73 | 856 B | - | | | | | | | | | | | | IncFlat | .NET 8.0 | 1024 | 10.04 ns | 0.010 ns | 0.009 ns | 1.00 | 1,019 B | - | | IncBlock | .NET 8.0 | 1024 | 14.22 ns | 0.029 ns | 0.027 ns | 1.42 | 863 B | - | | IncBlockAvxNotPinned | .NET 8.0 | 1024 | 14.38 ns | 0.008 ns | 0.007 ns | 1.43 | NA | - | | IncBlockAvxPinned | .NET 8.0 | 1024 | 12.41 ns | 0.011 ns | 0.011 ns | 1.24 | 863 B | - | | | | | | | | | | | | IncFlat | .NET 9.0 | 1024 | 10.36 ns | 0.050 ns | 0.046 ns | 1.00 | 1,003 B | - | | IncBlock | .NET 9.0 | 1024 | 15.41 ns | 0.125 ns | 0.111 ns | 1.49 | 852 B | - | | IncBlockAvxNotPinned | .NET 9.0 | 1024 | 13.69 ns | 0.012 ns | 0.011 ns | 1.32 | NA | - | | IncBlockAvxPinned | .NET 9.0 | 1024 | 12.40 ns | 0.010 ns | 0.009 ns | 1.20 | 844 B | - | | | | | | | | | | | | IncFlat | .NET 6.0 | 32768 | 21.18 ns | 0.047 ns | 0.044 ns | 1.00 | 852 B | - | | IncBlock | .NET 6.0 | 32768 | 18.01 ns | 0.039 ns | 0.036 ns | 0.85 | 813 B | - | | IncBlockAvxNotPinned | .NET 6.0 | 32768 | 15.95 ns | 0.051 ns | 0.048 ns | 0.75 | NA | - | | IncBlockAvxPinned | .NET 6.0 | 32768 | 15.28 ns | 0.030 ns | 0.027 ns | 0.72 | 856 B | - | | | | | | | | | | | | IncFlat | .NET 8.0 | 32768 | 11.31 ns | 0.011 ns | 0.010 ns | 1.00 | 1,019 B | - | | IncBlock | .NET 8.0 | 32768 | 15.74 ns | 0.023 ns | 0.019 ns | 1.39 | 863 B | - | | IncBlockAvxNotPinned | .NET 8.0 | 32768 | 14.08 ns | 0.014 ns | 0.011 ns | 1.24 | NA | - | | IncBlockAvxPinned | .NET 8.0 | 32768 | 12.54 ns | 0.011 ns | 0.010 ns | 1.11 | 863 B | - | | | | | | | | | | | | IncFlat | .NET 9.0 | 32768 | 10.99 ns | 0.013 ns | 0.012 ns | 1.00 | 1,003 B | - | | IncBlock | .NET 9.0 | 32768 | 17.17 ns | 0.025 ns | 0.023 ns | 1.56 | 852 B | - | | IncBlockAvxNotPinned | .NET 9.0 | 32768 | 13.74 ns | 0.023 ns | 0.021 ns | 1.25 | NA | - | | IncBlockAvxPinned | .NET 9.0 | 32768 | 12.57 ns | 0.017 ns | 0.016 ns | 1.14 | 844 B | - | | | | | | | | | | | | IncFlat | .NET 6.0 | 524288 | 27.79 ns | 0.467 ns | 0.390 ns | 1.00 | 852 B | - | | IncBlock | .NET 6.0 | 524288 | 26.43 ns | 0.186 ns | 0.145 ns | 0.95 | 813 B | - | | IncBlockAvxNotPinned | .NET 6.0 | 524288 | 24.87 ns | 0.115 ns | 0.090 ns | 0.90 | NA | - | | IncBlockAvxPinned | .NET 6.0 | 524288 | 23.26 ns | 0.135 ns | 0.120 ns | 0.84 | 856 B | - | | | | | | | | | | | | IncFlat | .NET 8.0 | 524288 | 18.46 ns | 0.189 ns | 0.177 ns | 1.00 | 1,017 B | - | | IncBlock | .NET 8.0 | 524288 | 23.63 ns | 0.114 ns | 0.107 ns | 1.28 | 863 B | - | | IncBlockAvxNotPinned | .NET 8.0 | 524288 | 40.75 ns | 0.423 ns | 0.395 ns | 2.21 | NA | - | | IncBlockAvxPinned | .NET 8.0 | 524288 | 20.95 ns | 0.092 ns | 0.086 ns | 1.13 | 863 B | - | | | | | | | | | | | | IncFlat | .NET 9.0 | 524288 | 18.29 ns | 0.284 ns | 0.266 ns | 1.00 | 1,004 B | - | | IncBlock | .NET 9.0 | 524288 | 23.77 ns | 0.148 ns | 0.139 ns | 1.30 | 855 B | - | | IncBlockAvxNotPinned | .NET 9.0 | 524288 | 22.06 ns | 0.136 ns | 0.127 ns | 1.21 | NA | - | | IncBlockAvxPinned | .NET 9.0 | 524288 | 21.16 ns | 0.107 ns | 0.100 ns | 1.16 | 844 B | - | | | | | | | | | | | | IncFlat | .NET 6.0 | 8388608 | 83.25 ns | 0.347 ns | 0.324 ns | 1.00 | 482 B | - | | IncBlock | .NET 6.0 | 8388608 | 66.31 ns | 0.238 ns | 0.211 ns | 0.80 | 443 B | - | | IncBlockAvxNotPinned | .NET 6.0 | 8388608 | 51.84 ns | 0.437 ns | 0.409 ns | 0.62 | NA | - | | IncBlockAvxPinned | .NET 6.0 | 8388608 | 49.40 ns | 0.377 ns | 0.353 ns | 0.59 | 486 B | - | | | | | | | | | | | | IncFlat | .NET 8.0 | 8388608 | 56.88 ns | 0.444 ns | 0.415 ns | 1.00 | 655 B | - | | IncBlock | .NET 8.0 | 8388608 | 59.86 ns | 0.252 ns | 0.210 ns | 1.05 | 499 B | - | | IncBlockAvxNotPinned | .NET 8.0 | 8388608 | 50.07 ns | 0.210 ns | 0.197 ns | 0.88 | NA | - | | IncBlockAvxPinned | .NET 8.0 | 8388608 | 42.44 ns | 0.178 ns | 0.149 ns | 0.75 | 499 B | - | | | | | | | | | | | | IncFlat | .NET 9.0 | 8388608 | 57.79 ns | 0.586 ns | 0.548 ns | 1.00 | 655 B | - | | IncBlock | .NET 9.0 | 8388608 | 59.96 ns | 0.387 ns | 0.362 ns | 1.04 | 504 B | - | | IncBlockAvxNotPinned | .NET 9.0 | 8388608 | 49.38 ns | 0.290 ns | 0.257 ns | 0.85 | NA | - | | IncBlockAvxPinned | .NET 9.0 | 8388608 | 42.13 ns | 0.323 ns | 0.302 ns | 0.73 | 496 B | - | | | | | | | | | | | | IncFlat | .NET 6.0 | 134217728 | 111.60 ns | 0.761 ns | 0.712 ns | 1.00 | 482 B | - | | IncBlock | .NET 6.0 | 134217728 | 86.40 ns | 1.305 ns | 1.220 ns | 0.77 | 443 B | - | | IncBlockAvxNotPinned | .NET 6.0 | 134217728 | 63.80 ns | 0.369 ns | 0.346 ns | 0.57 | NA | - | | IncBlockAvxPinned | .NET 6.0 | 134217728 | 61.29 ns | 0.568 ns | 0.531 ns | 0.55 | 486 B | - | | | | | | | | | | | | IncFlat | .NET 8.0 | 134217728 | 84.00 ns | 0.551 ns | 0.516 ns | 1.00 | 655 B | - | | IncBlock | .NET 8.0 | 134217728 | 78.41 ns | 0.522 ns | 0.488 ns | 0.93 | 499 B | - | | IncBlockAvxNotPinned | .NET 8.0 | 134217728 | 62.13 ns | 0.821 ns | 0.728 ns | 0.74 | NA | - | | IncBlockAvxPinned | .NET 8.0 | 134217728 | 51.84 ns | 0.313 ns | 0.278 ns | 0.62 | 499 B | - | | | | | | | | | | | | IncFlat | .NET 9.0 | 134217728 | 84.03 ns | 1.088 ns | 1.017 ns | 1.00 | 655 B | - | | IncBlock | .NET 9.0 | 134217728 | 78.25 ns | 0.985 ns | 0.921 ns | 0.93 | 504 B | - | | IncBlockAvxNotPinned | .NET 9.0 | 134217728 | 61.43 ns | 0.626 ns | 0.586 ns | 0.73 | NA | - | | IncBlockAvxPinned | .NET 9.0 | 134217728 | 51.50 ns | 0.265 ns | 0.248 ns | 0.61 | 496 B | - |

@coveralls
Copy link

coveralls commented Nov 21, 2024

Coverage Status

coverage: 99.218% (+0.01%) from 99.204%
when pulling 2c587a4 on users/alexpeck/avx2
into 1c2f221 on main.

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 21, 2024

AMD EPYC 7763, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4762.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX2
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2

BitFaster Caching Benchmarks Lfu SketchFrequency-columnchart

Tabular data
Method Runtime Size Mean Error StdDev Ratio Code Size Allocated
FrequencyFlat .NET 6.0 512 29.97 ns 0.068 ns 0.061 ns 1.00 314 B -
FrequencyBlock .NET 6.0 512 21.99 ns 0.008 ns 0.008 ns 0.73 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 512 16.66 ns 0.309 ns 0.413 ns 0.56 620 B -
FrequencyBlockAvxPinned .NET 6.0 512 14.29 ns 0.010 ns 0.009 ns 0.48 521 B -
FrequencyFlat .NET 8.0 512 15.44 ns 0.009 ns 0.008 ns 1.00 482 B -
FrequencyBlock .NET 8.0 512 20.65 ns 0.053 ns 0.050 ns 1.34 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 512 14.57 ns 0.023 ns 0.021 ns 0.94 757 B -
FrequencyBlockAvxPinned .NET 8.0 512 11.60 ns 0.003 ns 0.003 ns 0.75 622 B -
FrequencyFlat .NET 9.0 512 15.02 ns 0.005 ns 0.004 ns 1.00 472 B -
FrequencyBlock .NET 9.0 512 20.56 ns 0.049 ns 0.046 ns 1.37 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 512 13.96 ns 0.031 ns 0.029 ns 0.93 722 B -
FrequencyBlockAvxPinned .NET 9.0 512 11.60 ns 0.005 ns 0.004 ns 0.77 619 B -
FrequencyFlat .NET 6.0 1024 29.91 ns 0.123 ns 0.109 ns 1.00 314 B -
FrequencyBlock .NET 6.0 1024 21.98 ns 0.003 ns 0.003 ns 0.73 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 1024 16.52 ns 0.009 ns 0.008 ns 0.55 620 B -
FrequencyBlockAvxPinned .NET 6.0 1024 14.30 ns 0.005 ns 0.005 ns 0.48 521 B -
FrequencyFlat .NET 8.0 1024 15.53 ns 0.006 ns 0.005 ns 1.00 482 B -
FrequencyBlock .NET 8.0 1024 20.45 ns 0.197 ns 0.184 ns 1.32 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 1024 14.52 ns 0.007 ns 0.007 ns 0.94 757 B -
FrequencyBlockAvxPinned .NET 8.0 1024 11.60 ns 0.003 ns 0.002 ns 0.75 622 B -
FrequencyFlat .NET 9.0 1024 15.32 ns 0.008 ns 0.008 ns 1.00 472 B -
FrequencyBlock .NET 9.0 1024 20.39 ns 0.007 ns 0.006 ns 1.33 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 1024 13.89 ns 0.007 ns 0.007 ns 0.91 722 B -
FrequencyBlockAvxPinned .NET 9.0 1024 11.59 ns 0.003 ns 0.002 ns 0.76 619 B -
FrequencyFlat .NET 6.0 32768 29.96 ns 0.035 ns 0.031 ns 1.00 314 B -
FrequencyBlock .NET 6.0 32768 22.07 ns 0.006 ns 0.006 ns 0.74 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 32768 22.86 ns 0.302 ns 0.282 ns 0.76 620 B -
FrequencyBlockAvxPinned .NET 6.0 32768 36.63 ns 0.262 ns 0.245 ns 1.22 521 B -
FrequencyFlat .NET 8.0 32768 16.08 ns 0.008 ns 0.008 ns 1.00 482 B -
FrequencyBlock .NET 8.0 32768 21.53 ns 0.011 ns 0.010 ns 1.34 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 32768 18.37 ns 0.009 ns 0.008 ns 1.14 757 B -
FrequencyBlockAvxPinned .NET 8.0 32768 12.75 ns 0.004 ns 0.003 ns 0.79 622 B -
FrequencyFlat .NET 9.0 32768 15.68 ns 0.005 ns 0.004 ns 1.00 472 B -
FrequencyBlock .NET 9.0 32768 20.73 ns 0.010 ns 0.009 ns 1.32 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 32768 18.63 ns 0.006 ns 0.006 ns 1.19 722 B -
FrequencyBlockAvxPinned .NET 9.0 32768 12.92 ns 0.003 ns 0.003 ns 0.82 619 B -
FrequencyFlat .NET 6.0 524288 40.35 ns 0.046 ns 0.043 ns 1.00 314 B -
FrequencyBlock .NET 6.0 524288 31.64 ns 0.158 ns 0.148 ns 0.78 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 524288 28.36 ns 0.082 ns 0.073 ns 0.70 620 B -
FrequencyBlockAvxPinned .NET 6.0 524288 23.13 ns 0.161 ns 0.151 ns 0.57 521 B -
FrequencyFlat .NET 8.0 524288 23.60 ns 0.033 ns 0.030 ns 1.00 482 B -
FrequencyBlock .NET 8.0 524288 27.76 ns 0.161 ns 0.150 ns 1.18 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 524288 23.05 ns 0.018 ns 0.015 ns 0.98 757 B -
FrequencyBlockAvxPinned .NET 8.0 524288 18.37 ns 0.011 ns 0.009 ns 0.78 622 B -
FrequencyFlat .NET 9.0 524288 23.34 ns 0.008 ns 0.007 ns 1.00 472 B -
FrequencyBlock .NET 9.0 524288 27.88 ns 0.079 ns 0.070 ns 1.19 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 524288 23.18 ns 0.117 ns 0.110 ns 0.99 722 B -
FrequencyBlockAvxPinned .NET 9.0 524288 19.12 ns 0.103 ns 0.097 ns 0.82 619 B -
FrequencyFlat .NET 6.0 8388608 144.35 ns 0.743 ns 0.695 ns 1.00 314 B -
FrequencyBlock .NET 6.0 8388608 106.67 ns 2.108 ns 3.522 ns 0.74 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 8388608 100.58 ns 0.842 ns 0.788 ns 0.70 620 B -
FrequencyBlockAvxPinned .NET 6.0 8388608 65.48 ns 1.009 ns 0.842 ns 0.45 521 B -
FrequencyFlat .NET 8.0 8388608 97.84 ns 0.440 ns 0.367 ns 1.00 477 B -
FrequencyBlock .NET 8.0 8388608 94.81 ns 1.837 ns 2.576 ns 0.97 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 8388608 93.36 ns 0.249 ns 0.195 ns 0.95 757 B -
FrequencyBlockAvxPinned .NET 8.0 8388608 60.74 ns 0.825 ns 0.731 ns 0.62 622 B -
FrequencyFlat .NET 9.0 8388608 90.86 ns 1.728 ns 1.616 ns 1.00 472 B -
FrequencyBlock .NET 9.0 8388608 90.04 ns 1.763 ns 2.584 ns 0.99 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 8388608 92.41 ns 0.650 ns 0.608 ns 1.02 722 B -
FrequencyBlockAvxPinned .NET 9.0 8388608 63.95 ns 1.264 ns 2.078 ns 0.70 619 B -
FrequencyFlat .NET 6.0 134217728 166.75 ns 1.824 ns 1.523 ns 1.00 314 B -
FrequencyBlock .NET 6.0 134217728 140.43 ns 0.609 ns 0.540 ns 0.84 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 134217728 109.37 ns 1.018 ns 0.902 ns 0.66 620 B -
FrequencyBlockAvxPinned .NET 6.0 134217728 79.06 ns 0.435 ns 0.340 ns 0.47 521 B -
FrequencyFlat .NET 8.0 134217728 116.58 ns 0.936 ns 0.876 ns 1.00 477 B -
FrequencyBlock .NET 8.0 134217728 136.26 ns 1.476 ns 1.381 ns 1.17 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 134217728 105.62 ns 0.765 ns 0.716 ns 0.91 757 B -
FrequencyBlockAvxPinned .NET 8.0 134217728 74.99 ns 0.484 ns 0.453 ns 0.64 622 B -
FrequencyFlat .NET 9.0 134217728 105.64 ns 0.545 ns 0.483 ns 1.00 472 B -
FrequencyBlock .NET 9.0 134217728 130.81 ns 1.958 ns 1.832 ns 1.24 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 134217728 102.02 ns 0.218 ns 0.170 ns 0.97 722 B -
FrequencyBlockAvxPinned .NET 9.0 134217728 74.57 ns 0.244 ns 0.190 ns 0.71 619 B -

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 21, 2024

Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4762.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

BitFaster Caching Benchmarks Lfu SketchFrequency-columnchart

Tabular data | Method | Runtime | Size | Mean | Error | StdDev | Ratio | Code Size | Allocated | |--------------------------- |--------- |---------- |----------:|---------:|---------:|------:|----------:|----------:| | FrequencyFlat | .NET 6.0 | 512 | 25.43 ns | 0.100 ns | 0.089 ns | 1.00 | 314 B | - | | FrequencyBlock | .NET 6.0 | 512 | 21.17 ns | 0.063 ns | 0.059 ns | 0.83 | 342 B | - | | FrequencyBlockAvxNotPinned | .NET 6.0 | 512 | 27.04 ns | 0.024 ns | 0.023 ns | 1.06 | 620 B | - | | FrequencyBlockAvxPinned | .NET 6.0 | 512 | 25.57 ns | 0.012 ns | 0.011 ns | 1.01 | 521 B | - | | | | | | | | | | | | FrequencyFlat | .NET 8.0 | 512 | 14.95 ns | 0.015 ns | 0.014 ns | 1.00 | 482 B | - | | FrequencyBlock | .NET 8.0 | 512 | 17.10 ns | 0.014 ns | 0.012 ns | 1.14 | 460 B | - | | FrequencyBlockAvxNotPinned | .NET 8.0 | 512 | 24.96 ns | 0.012 ns | 0.012 ns | 1.67 | 721 B | - | | FrequencyBlockAvxPinned | .NET 8.0 | 512 | 23.30 ns | 0.020 ns | 0.019 ns | 1.56 | 614 B | - | | | | | | | | | | | | FrequencyFlat | .NET 9.0 | 512 | 14.45 ns | 0.012 ns | 0.011 ns | 1.00 | 472 B | - | | FrequencyBlock | .NET 9.0 | 512 | 17.43 ns | 0.015 ns | 0.014 ns | 1.21 | 463 B | - | | FrequencyBlockAvxNotPinned | .NET 9.0 | 512 | 24.68 ns | 0.009 ns | 0.008 ns | 1.71 | 718 B | - | | FrequencyBlockAvxPinned | .NET 9.0 | 512 | 23.29 ns | 0.016 ns | 0.015 ns | 1.61 | 611 B | - | | | | | | | | | | | | FrequencyFlat | .NET 6.0 | 1024 | 25.47 ns | 0.105 ns | 0.098 ns | 1.00 | 314 B | - | | FrequencyBlock | .NET 6.0 | 1024 | 21.15 ns | 0.018 ns | 0.017 ns | 0.83 | 342 B | - | | FrequencyBlockAvxNotPinned | .NET 6.0 | 1024 | 27.07 ns | 0.041 ns | 0.039 ns | 1.06 | 620 B | - | | FrequencyBlockAvxPinned | .NET 6.0 | 1024 | 25.57 ns | 0.020 ns | 0.019 ns | 1.00 | 521 B | - | | | | | | | | | | | | FrequencyFlat | .NET 8.0 | 1024 | 14.94 ns | 0.012 ns | 0.011 ns | 1.00 | 482 B | - | | FrequencyBlock | .NET 8.0 | 1024 | 17.05 ns | 0.012 ns | 0.010 ns | 1.14 | 460 B | - | | FrequencyBlockAvxNotPinned | .NET 8.0 | 1024 | 24.83 ns | 0.015 ns | 0.014 ns | 1.66 | 753 B | - | | FrequencyBlockAvxPinned | .NET 8.0 | 1024 | 23.29 ns | 0.011 ns | 0.010 ns | 1.56 | 614 B | - | | | | | | | | | | | | FrequencyFlat | .NET 9.0 | 1024 | 14.45 ns | 0.007 ns | 0.007 ns | 1.00 | 472 B | - | | FrequencyBlock | .NET 9.0 | 1024 | 17.46 ns | 0.008 ns | 0.007 ns | 1.21 | 463 B | - | | FrequencyBlockAvxNotPinned | .NET 9.0 | 1024 | 24.69 ns | 0.014 ns | 0.012 ns | 1.71 | 718 B | - | | FrequencyBlockAvxPinned | .NET 9.0 | 1024 | 23.30 ns | 0.002 ns | 0.001 ns | 1.61 | 611 B | - | | | | | | | | | | | | FrequencyFlat | .NET 6.0 | 32768 | 26.17 ns | 0.286 ns | 0.253 ns | 1.00 | 314 B | - | | FrequencyBlock | .NET 6.0 | 32768 | 22.31 ns | 0.013 ns | 0.011 ns | 0.85 | 342 B | - | | FrequencyBlockAvxNotPinned | .NET 6.0 | 32768 | 27.10 ns | 0.005 ns | 0.004 ns | 1.04 | 620 B | - | | FrequencyBlockAvxPinned | .NET 6.0 | 32768 | 25.60 ns | 0.017 ns | 0.015 ns | 0.98 | 521 B | - | | | | | | | | | | | | FrequencyFlat | .NET 8.0 | 32768 | 15.83 ns | 0.008 ns | 0.006 ns | 1.00 | 482 B | - | | FrequencyBlock | .NET 8.0 | 32768 | 17.96 ns | 0.010 ns | 0.009 ns | 1.13 | 460 B | - | | FrequencyBlockAvxNotPinned | .NET 8.0 | 32768 | 24.84 ns | 0.021 ns | 0.019 ns | 1.57 | 753 B | - | | FrequencyBlockAvxPinned | .NET 8.0 | 32768 | 23.28 ns | 0.005 ns | 0.004 ns | 1.47 | 614 B | - | | | | | | | | | | | | FrequencyFlat | .NET 9.0 | 32768 | 15.66 ns | 0.012 ns | 0.011 ns | 1.00 | 472 B | - | | FrequencyBlock | .NET 9.0 | 32768 | 18.34 ns | 0.022 ns | 0.019 ns | 1.17 | 463 B | - | | FrequencyBlockAvxNotPinned | .NET 9.0 | 32768 | 24.77 ns | 0.025 ns | 0.022 ns | 1.58 | 718 B | - | | FrequencyBlockAvxPinned | .NET 9.0 | 32768 | 23.38 ns | 0.015 ns | 0.013 ns | 1.49 | 611 B | - | | | | | | | | | | | | FrequencyFlat | .NET 6.0 | 524288 | 42.61 ns | 0.183 ns | 0.162 ns | 1.00 | 314 B | - | | FrequencyBlock | .NET 6.0 | 524288 | 31.42 ns | 0.493 ns | 0.461 ns | 0.74 | 342 B | - | | FrequencyBlockAvxNotPinned | .NET 6.0 | 524288 | 31.10 ns | 0.480 ns | 0.449 ns | 0.73 | 620 B | - | | FrequencyBlockAvxPinned | .NET 6.0 | 524288 | 25.79 ns | 0.032 ns | 0.027 ns | 0.61 | 521 B | - | | | | | | | | | | | | FrequencyFlat | .NET 8.0 | 524288 | 25.08 ns | 0.244 ns | 0.228 ns | 1.00 | 482 B | - | | FrequencyBlock | .NET 8.0 | 524288 | 24.91 ns | 0.094 ns | 0.083 ns | 0.99 | 460 B | - | | FrequencyBlockAvxNotPinned | .NET 8.0 | 524288 | 27.71 ns | 0.546 ns | 0.536 ns | 1.10 | 753 B | - | | FrequencyBlockAvxPinned | .NET 8.0 | 524288 | 23.41 ns | 0.018 ns | 0.015 ns | 0.93 | 614 B | - | | | | | | | | | | | | FrequencyFlat | .NET 9.0 | 524288 | 24.64 ns | 0.478 ns | 0.424 ns | 1.00 | 472 B | - | | FrequencyBlock | .NET 9.0 | 524288 | 24.60 ns | 0.188 ns | 0.167 ns | 1.00 | 463 B | - | | FrequencyBlockAvxNotPinned | .NET 9.0 | 524288 | 25.83 ns | 0.144 ns | 0.128 ns | 1.05 | 681 B | - | | FrequencyBlockAvxPinned | .NET 9.0 | 524288 | 23.44 ns | 0.011 ns | 0.010 ns | 0.95 | 611 B | - | | | | | | | | | | | | FrequencyFlat | .NET 6.0 | 8388608 | 142.28 ns | 0.667 ns | 0.624 ns | 1.00 | 314 B | - | | FrequencyBlock | .NET 6.0 | 8388608 | 102.97 ns | 0.343 ns | 0.321 ns | 0.72 | 342 B | - | | FrequencyBlockAvxNotPinned | .NET 6.0 | 8388608 | 85.47 ns | 0.596 ns | 0.557 ns | 0.60 | 620 B | - | | FrequencyBlockAvxPinned | .NET 6.0 | 8388608 | 57.11 ns | 0.198 ns | 0.175 ns | 0.40 | 521 B | - | | | | | | | | | | | | FrequencyFlat | .NET 8.0 | 8388608 | 84.30 ns | 0.549 ns | 0.513 ns | 1.00 | 477 B | - | | FrequencyBlock | .NET 8.0 | 8388608 | 69.33 ns | 0.131 ns | 0.116 ns | 0.82 | 460 B | - | | FrequencyBlockAvxNotPinned | .NET 8.0 | 8388608 | 72.32 ns | 0.129 ns | 0.101 ns | 0.86 | 753 B | - | | FrequencyBlockAvxPinned | .NET 8.0 | 8388608 | 50.19 ns | 0.171 ns | 0.160 ns | 0.60 | 614 B | - | | | | | | | | | | | | FrequencyFlat | .NET 9.0 | 8388608 | 83.38 ns | 0.610 ns | 0.541 ns | 1.00 | 472 B | - | | FrequencyBlock | .NET 9.0 | 8388608 | 68.75 ns | 0.159 ns | 0.141 ns | 0.82 | 463 B | - | | FrequencyBlockAvxNotPinned | .NET 9.0 | 8388608 | 69.98 ns | 0.238 ns | 0.223 ns | 0.84 | 718 B | - | | FrequencyBlockAvxPinned | .NET 9.0 | 8388608 | 50.57 ns | 0.380 ns | 0.356 ns | 0.61 | 611 B | - | | | | | | | | | | | | FrequencyFlat | .NET 6.0 | 134217728 | 186.33 ns | 0.907 ns | 0.804 ns | 1.00 | 314 B | - | | FrequencyBlock | .NET 6.0 | 134217728 | 146.52 ns | 2.765 ns | 2.586 ns | 0.79 | 342 B | - | | FrequencyBlockAvxNotPinned | .NET 6.0 | 134217728 | 103.13 ns | 1.148 ns | 1.074 ns | 0.55 | 620 B | - | | FrequencyBlockAvxPinned | .NET 6.0 | 134217728 | 70.37 ns | 0.525 ns | 0.491 ns | 0.38 | 521 B | - | | | | | | | | | | | | FrequencyFlat | .NET 8.0 | 134217728 | 115.60 ns | 0.415 ns | 0.388 ns | 1.00 | 477 B | - | | FrequencyBlock | .NET 8.0 | 134217728 | 87.00 ns | 0.971 ns | 0.908 ns | 0.75 | 460 B | - | | FrequencyBlockAvxNotPinned | .NET 8.0 | 134217728 | 86.52 ns | 1.106 ns | 1.034 ns | 0.75 | 753 B | - | | FrequencyBlockAvxPinned | .NET 8.0 | 134217728 | 62.39 ns | 0.426 ns | 0.399 ns | 0.54 | 614 B | - | | | | | | | | | | | | FrequencyFlat | .NET 9.0 | 134217728 | 114.19 ns | 0.759 ns | 0.673 ns | 1.00 | 472 B | - | | FrequencyBlock | .NET 9.0 | 134217728 | 86.99 ns | 0.496 ns | 0.439 ns | 0.76 | 463 B | - | | FrequencyBlockAvxNotPinned | .NET 9.0 | 134217728 | 83.31 ns | 1.528 ns | 1.429 ns | 0.73 | 718 B | - | | FrequencyBlockAvxPinned | .NET 9.0 | 134217728 | 62.77 ns | 0.410 ns | 0.363 ns | 0.55 | 611 B | - |

BitFaster.Caching.Benchmarks/Lfu/CmSketchPinNoOpt.cs Dismissed Show dismissed Hide dismissed
BitFaster.Caching.Benchmarks/Lfu/CmSketchPinNoOpt.cs Dismissed Show dismissed Hide dismissed
BitFaster.Caching.Benchmarks/Lfu/CmSketchPinNoOpt.cs Dismissed Show dismissed Hide dismissed
BitFaster.Caching.Benchmarks/Lfu/CmSketchPinNoOpt.cs Dismissed Show dismissed Hide dismissed
BitFaster.Caching.Benchmarks/Lfu/CmSketchPinNoOpt.cs Dismissed Show dismissed Hide dismissed
@bitfaster
Copy link
Owner Author

bitfaster commented Nov 22, 2024

BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2849) (Hyper-V)
AMD EPYC 7763, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4770.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX2
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2

BitFaster Caching Benchmarks Lfu SketchFrequency-columnchart

Tabular data
Method Runtime Size Mean Error StdDev Ratio Code Size Allocated
FrequencyFlat .NET 6.0 512 32.40 ns 0.029 ns 0.023 ns 1.00 314 B -
FrequencyBlock .NET 6.0 512 22.47 ns 0.439 ns 0.670 ns 0.69 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 512 16.78 ns 0.267 ns 0.223 ns 0.52 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 512 15.42 ns 0.022 ns 0.020 ns 0.48 562 B -
FrequencyBlockAvxPinned .NET 6.0 512 14.35 ns 0.170 ns 0.142 ns 0.44 521 B -
FrequencyFlat .NET 8.0 512 15.46 ns 0.035 ns 0.027 ns 1.00 482 B -
FrequencyBlock .NET 8.0 512 20.91 ns 0.012 ns 0.010 ns 1.35 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 512 14.48 ns 0.019 ns 0.016 ns 0.94 757 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 512 13.72 ns 0.018 ns 0.014 ns 0.89 668 B -
FrequencyBlockAvxPinned .NET 8.0 512 11.64 ns 0.091 ns 0.081 ns 0.75 622 B -
FrequencyFlat .NET 9.0 512 15.31 ns 0.012 ns 0.010 ns 1.00 472 B -
FrequencyBlock .NET 9.0 512 21.04 ns 0.057 ns 0.045 ns 1.37 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 512 13.70 ns 0.017 ns 0.015 ns 0.89 685 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 512 13.89 ns 0.185 ns 0.164 ns 0.91 662 B -
FrequencyBlockAvxPinned .NET 9.0 512 11.60 ns 0.008 ns 0.007 ns 0.76 619 B -
FrequencyFlat .NET 6.0 1024 33.21 ns 0.177 ns 0.138 ns 1.00 314 B -
FrequencyBlock .NET 6.0 1024 22.20 ns 0.376 ns 0.352 ns 0.67 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 1024 16.50 ns 0.003 ns 0.002 ns 0.50 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 1024 15.72 ns 0.299 ns 0.250 ns 0.47 562 B -
FrequencyBlockAvxPinned .NET 6.0 1024 14.42 ns 0.232 ns 0.217 ns 0.43 521 B -
FrequencyFlat .NET 8.0 1024 15.52 ns 0.006 ns 0.006 ns 1.00 482 B -
FrequencyBlock .NET 8.0 1024 20.92 ns 0.008 ns 0.007 ns 1.35 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 1024 14.62 ns 0.005 ns 0.004 ns 0.94 757 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 1024 13.77 ns 0.163 ns 0.136 ns 0.89 668 B -
FrequencyBlockAvxPinned .NET 8.0 1024 11.64 ns 0.114 ns 0.106 ns 0.75 622 B -
FrequencyFlat .NET 9.0 1024 15.32 ns 0.004 ns 0.004 ns 1.00 472 B -
FrequencyBlock .NET 9.0 1024 20.94 ns 0.027 ns 0.023 ns 1.37 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 1024 13.90 ns 0.034 ns 0.029 ns 0.91 722 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 1024 13.74 ns 0.011 ns 0.010 ns 0.90 662 B -
FrequencyBlockAvxPinned .NET 9.0 1024 11.62 ns 0.046 ns 0.038 ns 0.76 619 B -
FrequencyFlat .NET 6.0 32768 33.06 ns 0.038 ns 0.031 ns 1.00 314 B -
FrequencyBlock .NET 6.0 32768 22.09 ns 0.015 ns 0.012 ns 0.67 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 32768 22.71 ns 0.448 ns 0.533 ns 0.69 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 32768 21.35 ns 0.168 ns 0.140 ns 0.65 562 B -
FrequencyBlockAvxPinned .NET 6.0 32768 24.90 ns 0.495 ns 1.215 ns 0.75 521 B -
FrequencyFlat .NET 8.0 32768 16.10 ns 0.030 ns 0.026 ns 1.00 482 B -
FrequencyBlock .NET 8.0 32768 21.61 ns 0.057 ns 0.048 ns 1.34 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 32768 19.00 ns 0.068 ns 0.057 ns 1.18 757 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 32768 18.33 ns 0.039 ns 0.031 ns 1.14 668 B -
FrequencyBlockAvxPinned .NET 8.0 32768 12.97 ns 0.036 ns 0.030 ns 0.81 622 B -
FrequencyFlat .NET 9.0 32768 15.70 ns 0.020 ns 0.015 ns 1.00 472 B -
FrequencyBlock .NET 9.0 32768 21.55 ns 0.014 ns 0.013 ns 1.37 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 32768 18.19 ns 0.018 ns 0.015 ns 1.16 722 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 32768 18.15 ns 0.067 ns 0.056 ns 1.16 662 B -
FrequencyBlockAvxPinned .NET 9.0 32768 12.92 ns 0.099 ns 0.083 ns 0.82 619 B -
FrequencyFlat .NET 6.0 524288 40.46 ns 0.055 ns 0.046 ns 1.00 314 B -
FrequencyBlock .NET 6.0 524288 31.72 ns 0.243 ns 0.203 ns 0.78 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 524288 29.03 ns 0.484 ns 0.453 ns 0.72 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 524288 27.02 ns 0.104 ns 0.086 ns 0.67 562 B -
FrequencyBlockAvxPinned .NET 6.0 524288 23.35 ns 0.032 ns 0.042 ns 0.58 521 B -
FrequencyFlat .NET 8.0 524288 23.73 ns 0.106 ns 0.089 ns 1.00 482 B -
FrequencyBlock .NET 8.0 524288 27.72 ns 0.072 ns 0.056 ns 1.17 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 524288 23.97 ns 0.400 ns 0.374 ns 1.01 757 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 524288 23.17 ns 0.325 ns 0.288 ns 0.98 668 B -
FrequencyBlockAvxPinned .NET 8.0 524288 19.15 ns 0.095 ns 0.084 ns 0.81 622 B -
FrequencyFlat .NET 9.0 524288 23.50 ns 0.098 ns 0.082 ns 1.00 472 B -
FrequencyBlock .NET 9.0 524288 27.93 ns 0.193 ns 0.162 ns 1.19 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 524288 23.29 ns 0.331 ns 0.294 ns 0.99 722 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 524288 23.25 ns 0.441 ns 0.391 ns 0.99 662 B -
FrequencyBlockAvxPinned .NET 9.0 524288 19.01 ns 0.010 ns 0.008 ns 0.81 619 B -
FrequencyFlat .NET 6.0 8388608 146.53 ns 1.335 ns 1.114 ns 1.00 314 B -
FrequencyBlock .NET 6.0 8388608 114.64 ns 1.391 ns 1.301 ns 0.78 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 8388608 100.15 ns 0.752 ns 0.628 ns 0.68 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 8388608 99.99 ns 1.893 ns 1.859 ns 0.68 562 B -
FrequencyBlockAvxPinned .NET 6.0 8388608 69.52 ns 1.326 ns 1.474 ns 0.47 521 B -
FrequencyFlat .NET 8.0 8388608 99.96 ns 0.869 ns 0.770 ns 1.00 477 B -
FrequencyBlock .NET 8.0 8388608 104.52 ns 1.589 ns 1.327 ns 1.05 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 8388608 96.25 ns 0.532 ns 0.444 ns 0.96 757 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 8388608 96.03 ns 1.360 ns 1.206 ns 0.96 668 B -
FrequencyBlockAvxPinned .NET 8.0 8388608 70.79 ns 1.386 ns 2.032 ns 0.71 567 B -
FrequencyFlat .NET 9.0 8388608 95.34 ns 1.030 ns 0.913 ns 1.00 472 B -
FrequencyBlock .NET 9.0 8388608 99.27 ns 1.978 ns 1.943 ns 1.04 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 8388608 94.54 ns 0.929 ns 0.869 ns 0.99 722 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 8388608 93.48 ns 0.473 ns 0.395 ns 0.98 662 B -
FrequencyBlockAvxPinned .NET 9.0 8388608 66.67 ns 0.782 ns 0.731 ns 0.70 619 B -
FrequencyFlat .NET 6.0 134217728 165.64 ns 1.296 ns 1.212 ns 1.00 314 B -
FrequencyBlock .NET 6.0 134217728 144.15 ns 1.614 ns 1.431 ns 0.87 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 134217728 135.63 ns 1.146 ns 0.895 ns 0.82 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 134217728 108.76 ns 1.048 ns 0.929 ns 0.66 562 B -
FrequencyBlockAvxPinned .NET 6.0 134217728 78.97 ns 0.654 ns 0.580 ns 0.48 521 B -
FrequencyFlat .NET 8.0 134217728 115.94 ns 0.444 ns 0.394 ns 1.00 477 B -
FrequencyBlock .NET 8.0 134217728 137.19 ns 1.614 ns 1.431 ns 1.18 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 134217728 104.25 ns 1.052 ns 0.821 ns 0.90 757 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 134217728 102.32 ns 0.628 ns 0.524 ns 0.88 668 B -
FrequencyBlockAvxPinned .NET 8.0 134217728 76.59 ns 0.549 ns 0.487 ns 0.66 622 B -
FrequencyFlat .NET 9.0 134217728 105.47 ns 0.623 ns 0.521 ns 1.00 472 B -
FrequencyBlock .NET 9.0 134217728 138.19 ns 2.018 ns 1.685 ns 1.31 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 134217728 102.91 ns 1.469 ns 1.147 ns 0.98 722 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 134217728 103.41 ns 0.957 ns 0.895 ns 0.98 662 B -
FrequencyBlockAvxPinned .NET 9.0 134217728 76.32 ns 0.992 ns 0.880 ns 0.72 619 B -

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 22, 2024

BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2849) (Hyper-V)
AMD EPYC 7763, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4770.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX2
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2

BitFaster Caching Benchmarks Lfu SketchIncrement-columnchart

Tabular data
Method Runtime Size Mean Error StdDev Ratio Code Size Allocated
IncFlat .NET 6.0 512 21.934 ns 0.0458 ns 0.0428 ns 1.00 852 B -
IncBlock .NET 6.0 512 36.516 ns 1.2609 ns 3.7179 ns 1.66 813 B -
IncBlockAvxNotPinned .NET 6.0 512 11.811 ns 0.0111 ns 0.0093 ns 0.54 NA -
IncBlockAvxPinNotOpt .NET 6.0 512 10.934 ns 0.0054 ns 0.0051 ns 0.50 812 B -
IncBlockAvxPinned .NET 6.0 512 28.607 ns 0.5717 ns 1.1014 ns 1.30 856 B -
IncFlat .NET 8.0 512 10.902 ns 0.0020 ns 0.0018 ns 1.00 1,019 B -
IncBlock .NET 8.0 512 16.212 ns 0.0058 ns 0.0054 ns 1.49 863 B -
IncBlockAvxNotPinned .NET 8.0 512 10.916 ns 0.0048 ns 0.0045 ns 1.00 NA -
IncBlockAvxPinNotOpt .NET 8.0 512 10.382 ns 0.0020 ns 0.0019 ns 0.95 815 B -
IncBlockAvxPinned .NET 8.0 512 10.022 ns 0.0018 ns 0.0016 ns 0.92 870 B -
IncFlat .NET 9.0 512 10.896 ns 0.0028 ns 0.0025 ns 1.00 1,003 B -
IncBlock .NET 9.0 512 16.339 ns 0.0260 ns 0.0244 ns 1.50 852 B -
IncBlockAvxNotPinned .NET 9.0 512 14.037 ns 0.0307 ns 0.0288 ns 1.29 NA -
IncBlockAvxPinNotOpt .NET 9.0 512 10.295 ns 0.0052 ns 0.0049 ns 0.94 791 B -
IncBlockAvxPinned .NET 9.0 512 9.807 ns 0.0032 ns 0.0028 ns 0.90 846 B -
IncFlat .NET 6.0 1024 21.831 ns 0.0065 ns 0.0060 ns 1.00 852 B -
IncBlock .NET 6.0 1024 21.509 ns 0.0579 ns 0.0542 ns 0.99 813 B -
IncBlockAvxNotPinned .NET 6.0 1024 11.989 ns 0.1001 ns 0.0936 ns 0.55 NA -
IncBlockAvxPinNotOpt .NET 6.0 1024 10.988 ns 0.0046 ns 0.0043 ns 0.50 812 B -
IncBlockAvxPinned .NET 6.0 1024 23.317 ns 0.1680 ns 0.1571 ns 1.07 856 B -
IncFlat .NET 8.0 1024 10.887 ns 0.0044 ns 0.0042 ns 1.00 1,019 B -
IncBlock .NET 8.0 1024 16.400 ns 0.0080 ns 0.0075 ns 1.51 863 B -
IncBlockAvxNotPinned .NET 8.0 1024 11.019 ns 0.0050 ns 0.0047 ns 1.01 NA -
IncBlockAvxPinNotOpt .NET 8.0 1024 10.386 ns 0.0029 ns 0.0024 ns 0.95 810 B -
IncBlockAvxPinned .NET 8.0 1024 9.538 ns 0.0023 ns 0.0021 ns 0.88 870 B -
IncFlat .NET 9.0 1024 10.866 ns 0.0163 ns 0.0152 ns 1.00 1,003 B -
IncBlock .NET 9.0 1024 17.921 ns 0.3521 ns 0.6868 ns 1.65 852 B -
IncBlockAvxNotPinned .NET 9.0 1024 10.617 ns 0.0044 ns 0.0041 ns 0.98 NA -
IncBlockAvxPinNotOpt .NET 9.0 1024 10.448 ns 0.0058 ns 0.0049 ns 0.96 796 B -
IncBlockAvxPinned .NET 9.0 1024 9.186 ns 0.0015 ns 0.0012 ns 0.85 846 B -
IncFlat .NET 6.0 32768 21.857 ns 0.0086 ns 0.0077 ns 1.00 852 B -
IncBlock .NET 6.0 32768 36.866 ns 0.5721 ns 0.4777 ns 1.69 813 B -
IncBlockAvxNotPinned .NET 6.0 32768 13.650 ns 0.0131 ns 0.0123 ns 0.62 NA -
IncBlockAvxPinNotOpt .NET 6.0 32768 13.142 ns 0.0184 ns 0.0172 ns 0.60 812 B -
IncBlockAvxPinned .NET 6.0 32768 28.540 ns 1.4334 ns 4.2265 ns 1.31 856 B -
IncFlat .NET 8.0 32768 11.006 ns 0.0045 ns 0.0043 ns 1.00 1,019 B -
IncBlock .NET 8.0 32768 16.631 ns 0.0261 ns 0.0232 ns 1.51 863 B -
IncBlockAvxNotPinned .NET 8.0 32768 12.600 ns 0.0109 ns 0.0102 ns 1.14 NA -
IncBlockAvxPinNotOpt .NET 8.0 32768 11.764 ns 0.0030 ns 0.0025 ns 1.07 815 B -
IncBlockAvxPinned .NET 8.0 32768 10.406 ns 0.0029 ns 0.0024 ns 0.95 870 B -
IncFlat .NET 9.0 32768 11.006 ns 0.0045 ns 0.0050 ns 1.00 1,003 B -
IncBlock .NET 9.0 32768 16.726 ns 0.0050 ns 0.0045 ns 1.52 852 B -
IncBlockAvxNotPinned .NET 9.0 32768 11.860 ns 0.0045 ns 0.0040 ns 1.08 NA -
IncBlockAvxPinNotOpt .NET 9.0 32768 11.628 ns 0.0046 ns 0.0036 ns 1.06 796 B -
IncBlockAvxPinned .NET 9.0 32768 10.833 ns 0.0171 ns 0.0160 ns 0.98 851 B -
IncFlat .NET 6.0 524288 28.710 ns 0.1044 ns 0.0976 ns 1.00 852 B -
IncBlock .NET 6.0 524288 29.380 ns 0.1448 ns 0.1209 ns 1.02 813 B -
IncBlockAvxNotPinned .NET 6.0 524288 23.761 ns 0.1836 ns 0.1533 ns 0.83 NA -
IncBlockAvxPinNotOpt .NET 6.0 524288 26.191 ns 0.4775 ns 0.9537 ns 0.91 812 B -
IncBlockAvxPinned .NET 6.0 524288 25.075 ns 0.4985 ns 1.0624 ns 0.87 856 B -
IncFlat .NET 8.0 524288 16.935 ns 0.0388 ns 0.0344 ns 1.00 1,017 B -
IncBlock .NET 8.0 524288 23.166 ns 0.1067 ns 0.0998 ns 1.37 866 B -
IncBlockAvxNotPinned .NET 8.0 524288 21.330 ns 0.0757 ns 0.0708 ns 1.26 NA -
IncBlockAvxPinNotOpt .NET 8.0 524288 19.891 ns 0.1237 ns 0.1097 ns 1.17 815 B -
IncBlockAvxPinned .NET 8.0 524288 17.669 ns 0.0244 ns 0.0216 ns 1.04 870 B -
IncFlat .NET 9.0 524288 16.850 ns 0.0299 ns 0.0250 ns 1.00 1,004 B -
IncBlock .NET 9.0 524288 23.475 ns 0.0876 ns 0.0819 ns 1.39 855 B -
IncBlockAvxNotPinned .NET 9.0 524288 20.279 ns 0.0876 ns 0.0777 ns 1.20 NA -
IncBlockAvxPinNotOpt .NET 9.0 524288 20.746 ns 0.2442 ns 0.2284 ns 1.23 796 B -
IncBlockAvxPinned .NET 9.0 524288 17.694 ns 0.0279 ns 0.0233 ns 1.05 851 B -
IncFlat .NET 6.0 8388608 112.748 ns 1.1265 ns 0.8795 ns 1.00 482 B -
IncBlock .NET 6.0 8388608 64.792 ns 1.2301 ns 1.1507 ns 0.57 443 B -
IncBlockAvxNotPinned .NET 6.0 8388608 61.182 ns 0.7844 ns 0.7338 ns 0.54 NA -
IncBlockAvxPinNotOpt .NET 6.0 8388608 66.617 ns 0.5936 ns 0.5552 ns 0.59 442 B -
IncBlockAvxPinned .NET 6.0 8388608 64.684 ns 0.7178 ns 0.6714 ns 0.57 486 B -
IncFlat .NET 8.0 8388608 63.158 ns 0.3230 ns 0.3021 ns 1.00 655 B -
IncBlock .NET 8.0 8388608 59.506 ns 1.0010 ns 0.9364 ns 0.94 499 B -
IncBlockAvxNotPinned .NET 8.0 8388608 57.397 ns 0.6696 ns 0.5591 ns 0.91 NA -
IncBlockAvxPinNotOpt .NET 8.0 8388608 46.390 ns 0.9144 ns 1.3964 ns 0.73 451 B -
IncBlockAvxPinned .NET 8.0 8388608 44.396 ns 0.4457 ns 0.3951 ns 0.70 469 B -
IncFlat .NET 9.0 8388608 62.901 ns 0.2048 ns 0.1915 ns 1.00 655 B -
IncBlock .NET 9.0 8388608 60.299 ns 1.1703 ns 1.5623 ns 0.96 504 B -
IncBlockAvxNotPinned .NET 9.0 8388608 56.641 ns 1.0552 ns 0.9871 ns 0.90 NA -
IncBlockAvxPinNotOpt .NET 9.0 8388608 46.279 ns 0.7686 ns 0.6418 ns 0.74 448 B -
IncBlockAvxPinned .NET 9.0 8388608 44.078 ns 0.5358 ns 0.5012 ns 0.70 505 B -
IncFlat .NET 6.0 134217728 138.857 ns 2.7229 ns 3.9913 ns 1.00 482 B -
IncBlock .NET 6.0 134217728 77.328 ns 0.5594 ns 0.5232 ns 0.56 443 B -
IncBlockAvxNotPinned .NET 6.0 134217728 76.797 ns 1.4438 ns 1.3505 ns 0.55 NA -
IncBlockAvxPinNotOpt .NET 6.0 134217728 75.793 ns 0.5661 ns 0.5295 ns 0.55 442 B -
IncBlockAvxPinned .NET 6.0 134217728 74.867 ns 0.6998 ns 0.6546 ns 0.54 486 B -
IncFlat .NET 8.0 134217728 73.540 ns 0.3582 ns 0.3175 ns 1.00 655 B -
IncBlock .NET 8.0 134217728 73.398 ns 0.3882 ns 0.3441 ns 1.00 499 B -
IncBlockAvxNotPinned .NET 8.0 134217728 71.452 ns 0.7931 ns 0.7419 ns 0.97 NA -
IncBlockAvxPinNotOpt .NET 8.0 134217728 54.369 ns 0.4871 ns 0.4318 ns 0.74 451 B -
IncBlockAvxPinned .NET 8.0 134217728 52.579 ns 0.7140 ns 0.6679 ns 0.71 506 B -
IncFlat .NET 9.0 134217728 73.873 ns 0.3239 ns 0.2872 ns 1.00 655 B -
IncBlock .NET 9.0 134217728 73.309 ns 0.8473 ns 0.7926 ns 0.99 504 B -
IncBlockAvxNotPinned .NET 9.0 134217728 70.057 ns 0.7195 ns 0.6731 ns 0.95 NA -
IncBlockAvxPinNotOpt .NET 9.0 134217728 54.270 ns 0.5798 ns 0.5140 ns 0.73 448 B -
IncBlockAvxPinned .NET 9.0 134217728 51.711 ns 0.2901 ns 0.2572 ns 0.70 503 B -

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 23, 2024

BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2849) (Hyper-V)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4770.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  .NET 9.0 : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

BitFaster Caching Benchmarks Lfu SketchFrequency-columnchart

Tabular data
Method Runtime Size Mean Error StdDev Ratio Code Size Allocated
FrequencyFlat .NET 6.0 512 26.10 ns 0.018 ns 0.016 ns 1.00 314 B -
FrequencyBlock .NET 6.0 512 21.35 ns 0.034 ns 0.031 ns 0.82 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 512 27.04 ns 0.017 ns 0.015 ns 1.04 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 512 27.20 ns 0.015 ns 0.013 ns 1.04 562 B -
FrequencyBlockAvxPinned .NET 6.0 512 25.54 ns 0.014 ns 0.020 ns 0.98 521 B -
FrequencyFlat .NET 8.0 512 14.94 ns 0.010 ns 0.009 ns 1.00 482 B -
FrequencyBlock .NET 8.0 512 17.20 ns 0.010 ns 0.009 ns 1.15 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 512 25.01 ns 0.011 ns 0.008 ns 1.67 753 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 512 24.96 ns 0.020 ns 0.019 ns 1.67 664 B -
FrequencyBlockAvxPinned .NET 8.0 512 23.28 ns 0.011 ns 0.011 ns 1.56 614 B -
FrequencyFlat .NET 9.0 512 14.44 ns 0.007 ns 0.006 ns 1.00 472 B -
FrequencyBlock .NET 9.0 512 17.42 ns 0.018 ns 0.016 ns 1.21 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 512 24.69 ns 0.014 ns 0.012 ns 1.71 718 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 512 24.69 ns 0.009 ns 0.007 ns 1.71 658 B -
FrequencyBlockAvxPinned .NET 9.0 512 23.30 ns 0.022 ns 0.017 ns 1.61 611 B -
FrequencyFlat .NET 6.0 1024 26.50 ns 0.513 ns 0.549 ns 1.00 314 B -
FrequencyBlock .NET 6.0 1024 21.38 ns 0.043 ns 0.039 ns 0.81 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 1024 27.07 ns 0.062 ns 0.052 ns 1.02 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 1024 27.23 ns 0.070 ns 0.058 ns 1.03 562 B -
FrequencyBlockAvxPinned .NET 6.0 1024 25.62 ns 0.106 ns 0.089 ns 0.97 521 B -
FrequencyFlat .NET 8.0 1024 15.00 ns 0.008 ns 0.007 ns 1.00 482 B -
FrequencyBlock .NET 8.0 1024 17.16 ns 0.010 ns 0.010 ns 1.14 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 1024 25.06 ns 0.026 ns 0.023 ns 1.67 753 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 1024 24.99 ns 0.015 ns 0.013 ns 1.67 664 B -
FrequencyBlockAvxPinned .NET 8.0 1024 23.30 ns 0.008 ns 0.008 ns 1.55 614 B -
FrequencyFlat .NET 9.0 1024 14.47 ns 0.009 ns 0.008 ns 1.00 472 B -
FrequencyBlock .NET 9.0 1024 17.42 ns 0.028 ns 0.025 ns 1.20 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 1024 24.69 ns 0.010 ns 0.009 ns 1.71 718 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 1024 24.70 ns 0.023 ns 0.021 ns 1.71 658 B -
FrequencyBlockAvxPinned .NET 9.0 1024 23.30 ns 0.010 ns 0.009 ns 1.61 611 B -
FrequencyFlat .NET 6.0 32768 25.91 ns 0.047 ns 0.042 ns 1.00 314 B -
FrequencyBlock .NET 6.0 32768 22.24 ns 0.024 ns 0.022 ns 0.86 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 32768 27.15 ns 0.030 ns 0.026 ns 1.05 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 32768 27.26 ns 0.035 ns 0.033 ns 1.05 562 B -
FrequencyBlockAvxPinned .NET 6.0 32768 25.59 ns 0.019 ns 0.017 ns 0.99 521 B -
FrequencyFlat .NET 8.0 32768 15.87 ns 0.008 ns 0.007 ns 1.00 482 B -
FrequencyBlock .NET 8.0 32768 18.08 ns 0.026 ns 0.022 ns 1.14 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 32768 24.86 ns 0.034 ns 0.032 ns 1.57 753 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 32768 25.11 ns 0.015 ns 0.013 ns 1.58 664 B -
FrequencyBlockAvxPinned .NET 8.0 32768 23.33 ns 0.014 ns 0.012 ns 1.47 614 B -
FrequencyFlat .NET 9.0 32768 15.52 ns 0.032 ns 0.025 ns 1.00 472 B -
FrequencyBlock .NET 9.0 32768 18.13 ns 0.025 ns 0.019 ns 1.17 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 32768 24.79 ns 0.014 ns 0.013 ns 1.60 718 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 32768 24.80 ns 0.027 ns 0.023 ns 1.60 658 B -
FrequencyBlockAvxPinned .NET 9.0 32768 23.32 ns 0.012 ns 0.011 ns 1.50 611 B -
FrequencyFlat .NET 6.0 524288 41.99 ns 0.775 ns 0.687 ns 1.00 314 B -
FrequencyBlock .NET 6.0 524288 30.65 ns 0.459 ns 0.429 ns 0.73 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 524288 29.60 ns 0.538 ns 0.503 ns 0.71 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 524288 28.45 ns 0.212 ns 0.188 ns 0.68 562 B -
FrequencyBlockAvxPinned .NET 6.0 524288 25.70 ns 0.021 ns 0.019 ns 0.61 521 B -
FrequencyFlat .NET 8.0 524288 24.84 ns 0.449 ns 0.398 ns 1.00 482 B -
FrequencyBlock .NET 8.0 524288 24.78 ns 0.219 ns 0.205 ns 1.00 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 524288 26.35 ns 0.169 ns 0.141 ns 1.06 753 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 524288 25.98 ns 0.104 ns 0.097 ns 1.05 664 B -
FrequencyBlockAvxPinned .NET 8.0 524288 23.39 ns 0.017 ns 0.015 ns 0.94 614 B -
FrequencyFlat .NET 9.0 524288 24.41 ns 0.269 ns 0.225 ns 1.00 472 B -
FrequencyBlock .NET 9.0 524288 24.66 ns 0.291 ns 0.243 ns 1.01 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 524288 25.74 ns 0.149 ns 0.139 ns 1.05 718 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 524288 25.56 ns 0.127 ns 0.119 ns 1.05 658 B -
FrequencyBlockAvxPinned .NET 9.0 524288 23.43 ns 0.027 ns 0.023 ns 0.96 611 B -
FrequencyFlat .NET 6.0 8388608 138.50 ns 1.684 ns 1.575 ns 1.00 314 B -
FrequencyBlock .NET 6.0 8388608 98.43 ns 0.982 ns 0.919 ns 0.71 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 8388608 81.95 ns 0.366 ns 0.342 ns 0.59 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 8388608 80.23 ns 0.863 ns 0.807 ns 0.58 562 B -
FrequencyBlockAvxPinned .NET 6.0 8388608 54.73 ns 0.463 ns 0.433 ns 0.40 521 B -
FrequencyFlat .NET 8.0 8388608 80.38 ns 0.846 ns 0.750 ns 1.00 477 B -
FrequencyBlock .NET 8.0 8388608 67.36 ns 0.617 ns 0.547 ns 0.84 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 8388608 70.65 ns 0.396 ns 0.351 ns 0.88 753 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 8388608 68.88 ns 0.549 ns 0.513 ns 0.86 664 B -
FrequencyBlockAvxPinned .NET 8.0 8388608 51.39 ns 0.346 ns 0.307 ns 0.64 614 B -
FrequencyFlat .NET 9.0 8388608 79.96 ns 1.064 ns 0.995 ns 1.00 472 B -
FrequencyBlock .NET 9.0 8388608 66.53 ns 0.940 ns 0.879 ns 0.83 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 8388608 68.17 ns 0.767 ns 0.680 ns 0.85 718 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 8388608 68.11 ns 0.586 ns 0.548 ns 0.85 658 B -
FrequencyBlockAvxPinned .NET 9.0 8388608 49.38 ns 0.229 ns 0.203 ns 0.62 611 B -
FrequencyFlat .NET 6.0 134217728 184.14 ns 1.738 ns 1.541 ns 1.00 314 B -
FrequencyBlock .NET 6.0 134217728 136.29 ns 1.706 ns 1.596 ns 0.74 342 B -
FrequencyBlockAvxNotPinned .NET 6.0 134217728 93.22 ns 1.340 ns 1.254 ns 0.51 620 B -
FrequencyBlockAvxPinNotOpt .NET 6.0 134217728 95.61 ns 1.260 ns 1.178 ns 0.52 562 B -
FrequencyBlockAvxPinned .NET 6.0 134217728 67.40 ns 0.520 ns 0.461 ns 0.37 521 B -
FrequencyFlat .NET 8.0 134217728 112.51 ns 0.629 ns 0.525 ns 1.00 477 B -
FrequencyBlock .NET 8.0 134217728 84.88 ns 1.134 ns 1.005 ns 0.75 460 B -
FrequencyBlockAvxNotPinned .NET 8.0 134217728 82.45 ns 1.230 ns 1.150 ns 0.73 753 B -
FrequencyBlockAvxPinNotOpt .NET 8.0 134217728 77.80 ns 1.068 ns 0.892 ns 0.69 664 B -
FrequencyBlockAvxPinned .NET 8.0 134217728 60.66 ns 0.431 ns 0.403 ns 0.54 614 B -
FrequencyFlat .NET 9.0 134217728 112.21 ns 0.481 ns 0.450 ns 1.00 472 B -
FrequencyBlock .NET 9.0 134217728 83.98 ns 0.633 ns 0.592 ns 0.75 463 B -
FrequencyBlockAvxNotPinned .NET 9.0 134217728 75.95 ns 0.891 ns 0.790 ns 0.68 718 B -
FrequencyBlockAvxPinNotOpt .NET 9.0 134217728 76.26 ns 0.595 ns 0.497 ns 0.68 658 B -
FrequencyBlockAvxPinned .NET 9.0 134217728 60.42 ns 0.359 ns 0.336 ns 0.54 611 B -

@bitfaster
Copy link
Owner Author

bitfaster commented Nov 23, 2024

BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2849) (Hyper-V)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  [Host]   : .NET Framework 4.8 (4.8.4770.0), X64 RyuJIT VectorSize=256
  .NET 6.0 : .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2
  .NET 8.0 : .NET 8.0.11 (8.0.1124.51707), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  .NET 9.0 : .NET 9.0.0 (9.0.24

BitFaster Caching Benchmarks Lfu SketchIncrement-columnchart

Tabular data
Method Runtime Size Mean Error StdDev Ratio Code Size Allocated
IncFlat .NET 6.0 512 22.38 ns 0.157 ns 0.147 ns 1.00 852 B -
IncBlock .NET 6.0 512 17.77 ns 0.052 ns 0.048 ns 0.79 813 B -
IncBlockAvxNotPinned .NET 6.0 512 16.23 ns 0.036 ns 0.033 ns 0.73 NA -
IncBlockAvxPinNotOpt .NET 6.0 512 15.07 ns 0.034 ns 0.031 ns 0.67 812 B -
IncBlockAvxPinned .NET 6.0 512 15.46 ns 0.022 ns 0.018 ns 0.69 856 B -
IncFlat .NET 8.0 512 10.01 ns 0.008 ns 0.008 ns 1.00 1,019 B -
IncBlock .NET 8.0 512 14.50 ns 0.024 ns 0.022 ns 1.45 863 B -
IncBlockAvxNotPinned .NET 8.0 512 14.50 ns 0.006 ns 0.005 ns 1.45 NA -
IncBlockAvxPinNotOpt .NET 8.0 512 13.36 ns 0.004 ns 0.003 ns 1.33 808 B -
IncBlockAvxPinned .NET 8.0 512 12.51 ns 0.006 ns 0.005 ns 1.25 863 B -
IncFlat .NET 9.0 512 10.35 ns 0.039 ns 0.037 ns 1.00 1,003 B -
IncBlock .NET 9.0 512 15.53 ns 0.119 ns 0.111 ns 1.50 852 B -
IncBlockAvxNotPinned .NET 9.0 512 13.63 ns 0.005 ns 0.004 ns 1.32 NA -
IncBlockAvxPinNotOpt .NET 9.0 512 13.10 ns 0.010 ns 0.010 ns 1.27 789 B -
IncBlockAvxPinned .NET 9.0 512 12.40 ns 0.004 ns 0.003 ns 1.20 840 B -
IncFlat .NET 6.0 1024 22.25 ns 0.117 ns 0.109 ns 1.00 852 B -
IncBlock .NET 6.0 1024 17.16 ns 0.041 ns 0.037 ns 0.77 813 B -
IncBlockAvxNotPinned .NET 6.0 1024 15.58 ns 0.054 ns 0.051 ns 0.70 NA -
IncBlockAvxPinNotOpt .NET 6.0 1024 15.84 ns 0.014 ns 0.013 ns 0.71 812 B -
IncBlockAvxPinned .NET 6.0 1024 15.46 ns 0.022 ns 0.021 ns 0.69 856 B -
IncFlat .NET 8.0 1024 10.07 ns 0.012 ns 0.012 ns 1.00 1,019 B -
IncBlock .NET 8.0 1024 14.33 ns 0.012 ns 0.012 ns 1.42 863 B -
IncBlockAvxNotPinned .NET 8.0 1024 14.22 ns 0.009 ns 0.008 ns 1.41 NA -
IncBlockAvxPinNotOpt .NET 8.0 1024 13.37 ns 0.007 ns 0.006 ns 1.33 808 B -
IncBlockAvxPinned .NET 8.0 1024 12.38 ns 0.007 ns 0.006 ns 1.23 863 B -
IncFlat .NET 9.0 1024 10.31 ns 0.005 ns 0.005 ns 1.00 1,003 B -
IncBlock .NET 9.0 1024 15.46 ns 0.069 ns 0.064 ns 1.50 852 B -
IncBlockAvxNotPinned .NET 9.0 1024 14.21 ns 0.005 ns 0.005 ns 1.38 NA -
IncBlockAvxPinNotOpt .NET 9.0 1024 13.30 ns 0.004 ns 0.003 ns 1.29 789 B -
IncBlockAvxPinned .NET 9.0 1024 12.38 ns 0.006 ns 0.006 ns 1.20 844 B -
IncFlat .NET 6.0 32768 22.37 ns 0.111 ns 0.104 ns 1.00 852 B -
IncBlock .NET 6.0 32768 17.83 ns 0.044 ns 0.041 ns 0.80 813 B -
IncBlockAvxNotPinned .NET 6.0 32768 15.59 ns 0.047 ns 0.044 ns 0.70 NA -
IncBlockAvxPinNotOpt .NET 6.0 32768 15.87 ns 0.018 ns 0.016 ns 0.71 812 B -
IncBlockAvxPinned .NET 6.0 32768 15.59 ns 0.034 ns 0.032 ns 0.70 856 B -
IncFlat .NET 8.0 32768 11.26 ns 0.006 ns 0.005 ns 1.00 1,019 B -
IncBlock .NET 8.0 32768 15.31 ns 0.046 ns 0.043 ns 1.36 863 B -
IncBlockAvxNotPinned .NET 8.0 32768 14.53 ns 0.006 ns 0.005 ns 1.29 NA -
IncBlockAvxPinNotOpt .NET 8.0 32768 13.68 ns 0.003 ns 0.002 ns 1.22 812 B -
IncBlockAvxPinned .NET 8.0 32768 12.58 ns 0.004 ns 0.004 ns 1.12 863 B -
IncFlat .NET 9.0 32768 11.28 ns 0.008 ns 0.007 ns 1.00 1,003 B -
IncBlock .NET 9.0 32768 16.76 ns 0.023 ns 0.019 ns 1.49 852 B -
IncBlockAvxNotPinned .NET 9.0 32768 13.73 ns 0.007 ns 0.006 ns 1.22 NA -
IncBlockAvxPinNotOpt .NET 9.0 32768 13.20 ns 0.007 ns 0.007 ns 1.17 793 B -
IncBlockAvxPinned .NET 9.0 32768 12.56 ns 0.004 ns 0.004 ns 1.11 844 B -
IncFlat .NET 6.0 524288 27.45 ns 0.358 ns 0.335 ns 1.00 852 B -
IncBlock .NET 6.0 524288 26.48 ns 0.213 ns 0.199 ns 0.96 813 B -
IncBlockAvxNotPinned .NET 6.0 524288 25.00 ns 0.161 ns 0.150 ns 0.91 NA -
IncBlockAvxPinNotOpt .NET 6.0 524288 24.07 ns 0.124 ns 0.116 ns 0.88 812 B -
IncBlockAvxPinned .NET 6.0 524288 22.91 ns 0.140 ns 0.131 ns 0.83 856 B -
IncFlat .NET 8.0 524288 18.36 ns 0.065 ns 0.054 ns 1.00 1,017 B -
IncBlock .NET 8.0 524288 23.96 ns 0.192 ns 0.179 ns 1.30 863 B -
IncBlockAvxNotPinned .NET 8.0 524288 23.36 ns 0.012 ns 0.011 ns 1.27 NA -
IncBlockAvxPinNotOpt .NET 8.0 524288 21.78 ns 0.135 ns 0.127 ns 1.19 812 B -
IncBlockAvxPinned .NET 8.0 524288 21.28 ns 0.117 ns 0.104 ns 1.16 863 B -
IncFlat .NET 9.0 524288 18.09 ns 0.219 ns 0.205 ns 1.00 1,001 B -
IncBlock .NET 9.0 524288 23.99 ns 0.192 ns 0.180 ns 1.33 852 B -
IncBlockAvxNotPinned .NET 9.0 524288 22.14 ns 0.006 ns 0.005 ns 1.22 NA -
IncBlockAvxPinNotOpt .NET 9.0 524288 41.43 ns 0.143 ns 0.127 ns 2.29 795 B -
IncBlockAvxPinned .NET 9.0 524288 21.25 ns 0.106 ns 0.099 ns 1.18 844 B -
IncFlat .NET 6.0 8388608 71.36 ns 1.257 ns 1.176 ns 1.00 482 B -
IncBlock .NET 6.0 8388608 57.16 ns 0.890 ns 1.025 ns 0.80 443 B -
IncBlockAvxNotPinned .NET 6.0 8388608 44.97 ns 0.844 ns 0.790 ns 0.63 NA -
IncBlockAvxPinNotOpt .NET 6.0 8388608 43.06 ns 0.613 ns 0.544 ns 0.60 442 B -
IncBlockAvxPinned .NET 6.0 8388608 42.15 ns 0.733 ns 0.686 ns 0.59 486 B -
IncFlat .NET 8.0 8388608 47.89 ns 0.565 ns 0.529 ns 1.00 655 B -
IncBlock .NET 8.0 8388608 49.39 ns 0.980 ns 1.497 ns 1.03 499 B -
IncBlockAvxNotPinned .NET 8.0 8388608 42.73 ns 0.824 ns 1.042 ns 0.89 NA -
IncBlockAvxPinNotOpt .NET 8.0 8388608 41.42 ns 0.777 ns 0.798 ns 0.87 448 B -
IncBlockAvxPinned .NET 8.0 8388608 36.91 ns 0.503 ns 0.470 ns 0.77 499 B -
IncFlat .NET 9.0 8388608 49.04 ns 0.593 ns 0.495 ns 1.00 655 B -
IncBlock .NET 9.0 8388608 48.39 ns 0.953 ns 1.272 ns 0.99 504 B -
IncBlockAvxNotPinned .NET 9.0 8388608 42.35 ns 0.844 ns 1.037 ns 0.86 NA -
IncBlockAvxPinNotOpt .NET 9.0 8388608 40.58 ns 0.779 ns 0.865 ns 0.83 445 B -
IncBlockAvxPinned .NET 9.0 8388608 36.16 ns 0.505 ns 0.472 ns 0.74 498 B -
IncFlat .NET 6.0 134217728 107.72 ns 0.331 ns 0.310 ns 1.00 482 B -
IncBlock .NET 6.0 134217728 79.34 ns 0.350 ns 0.327 ns 0.74 443 B -
IncBlockAvxNotPinned .NET 6.0 134217728 60.57 ns 0.145 ns 0.136 ns 0.56 NA -
IncBlockAvxPinNotOpt .NET 6.0 134217728 59.80 ns 0.199 ns 0.186 ns 0.56 442 B -
IncBlockAvxPinned .NET 6.0 134217728 58.16 ns 0.277 ns 0.259 ns 0.54 486 B -
IncFlat .NET 8.0 134217728 81.85 ns 0.652 ns 0.610 ns 1.00 655 B -
IncBlock .NET 8.0 134217728 72.68 ns 0.616 ns 0.576 ns 0.89 499 B -
IncBlockAvxNotPinned .NET 8.0 134217728 58.82 ns 0.358 ns 0.318 ns 0.72 NA -
IncBlockAvxPinNotOpt .NET 8.0 134217728 57.67 ns 0.354 ns 0.331 ns 0.70 448 B -
IncBlockAvxPinned .NET 8.0 134217728 49.14 ns 0.308 ns 0.273 ns 0.60 499 B -
IncFlat .NET 9.0 134217728 81.90 ns 0.748 ns 0.700 ns 1.00 655 B -
IncBlock .NET 9.0 134217728 72.50 ns 0.326 ns 0.305 ns 0.89 504 B -
IncBlockAvxNotPinned .NET 9.0 134217728 57.94 ns 0.369 ns 0.345 ns 0.71 NA -
IncBlockAvxPinNotOpt .NET 9.0 134217728 153.58 ns 0.684 ns 0.640 ns 1.88 445 B -
IncBlockAvxPinned .NET 9.0 134217728 49.49 ns 0.186 ns 0.174 ns 0.60 496 B -

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