Skip to content

Throughput bench does work on cache miss #591

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
void action(int index)
{
long[] samples = config.GetTestData(index);
int func(long x) => (int)x;
int func(long x) => Spread(Spread(Spread(Hash32(x))));

for (int i = 0; i < config.Iterations; i++)
{
Expand Down Expand Up @@ -137,6 +137,30 @@
// throughput = million ops/sec
return throughput;
}

// https://lemire.me/blog/2018/08/15/fast-strongly-universal-64-bit-hashing-everywhere/
private static readonly long a = 46601;
private static long b = 471486146934863;
private static long c = 7411438065634025597l;

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / mac

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / mac

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / mac

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / mac

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / infer

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / infer

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / infer

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / infer

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / linux

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-win

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-macos

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-macos

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-macos

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

Check warning on line 144 in BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

View workflow job for this annotation

GitHub Actions / bench-macos

The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity

[MethodImpl(MethodImplOptions.NoInlining)]
private static int Hash32(long x)
{
int low = (int)x;
int high = (int)((uint)x >> 32);
return (int)((uint)(a * low + b * high + c) >> 32);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static int Spread(int x)
{
x ^= (int)((uint)x >> 17);
x = (int)(x * 0xed5ad4bb);
x ^= (int)((uint)x >> 11);
x = (int)(x * 0xac4c1b51);
x ^= (int)((uint)x >> 15);
return x;
}
}

public class UpdateThroughputBenchmark : ThroughputBenchmarkBase
Expand Down
Loading