Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfaster committed Nov 29, 2024
1 parent 4841b22 commit 7780042
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions BitFaster.Caching.Benchmarks/Lfu/SketchFrequency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class SketchFrequency

private CmSketchCore<int, DisableHardwareIntrinsics> blockStd;
private CmSketchNoPin<int, DetectIsa> blockAvxNoPin;
private CmSketchCore<int, DetectIsa> blockVector;
private CmSketchCore<int, DetectIsa> blockAvx;

[Params(32_768, 524_288, 8_388_608, 134_217_728)]
public int Size { get; set; }
Expand All @@ -39,7 +39,7 @@ public void Setup()

blockStd = new CmSketchCore<int, DisableHardwareIntrinsics>(Size, EqualityComparer<int>.Default);
blockAvxNoPin = new CmSketchNoPin<int, DetectIsa>(Size, EqualityComparer<int>.Default);
blockVector = new CmSketchCore<int, DetectIsa>(Size, EqualityComparer<int>.Default);
blockAvx = new CmSketchCore<int, DetectIsa>(Size, EqualityComparer<int>.Default);
}

[Benchmark(Baseline = true, OperationsPerInvoke = iterations)]
Expand Down Expand Up @@ -81,7 +81,7 @@ public int FrequencyBlockAvxNotPinned()
{
int count = 0;
for (int i = 0; i < iterations; i++)
count += blockAvxNoPin.EstimateFrequency(i) > blockVector.EstimateFrequency(i + 1) ? 1 : 0;
count += blockAvxNoPin.EstimateFrequency(i) > blockAvx.EstimateFrequency(i + 1) ? 1 : 0;

return count;
}
Expand All @@ -96,7 +96,7 @@ public int FrequencyBlockAvxPinned()
{
int count = 0;
for (int i = 0; i < iterations; i++)
count += blockVector.EstimateFrequency(i) > blockVector.EstimateFrequency(i + 1) ? 1 : 0;
count += blockAvx.EstimateFrequency(i) > blockAvx.EstimateFrequency(i + 1) ? 1 : 0;

return count;
}
Expand Down
7 changes: 3 additions & 4 deletions BitFaster.Caching/Lfu/CmSketchCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ public unsafe class CmSketchCore<T, I>
private const long OneMask = 0x1111111111111111L;

private long[] table;
private int sampleSize;
private int blockMask;
private int size;

#if NET6_0_OR_GREATER
private long* tableAddr;
#endif
private int sampleSize;
private int blockMask;
private int size;

private readonly IEqualityComparer<T> comparer;

Expand Down

0 comments on commit 7780042

Please sign in to comment.