Commit bf35e628 authored by Nick Craver's avatar Nick Craver

Add benchmarks for StringSet and StringGet

parent 5cb4cb51
......@@ -64,7 +64,7 @@ public RedisBenchmarks()
db.GeoAdd(GeoKey, 13.361389, 38.115556, "Palermo ");
db.GeoAdd(GeoKey, 15.087269, 37.502669, "Catania");
}
private static readonly RedisKey GeoKey = "GeoTest", IncrByKey = "counter";
private static readonly RedisKey GeoKey = "GeoTest", IncrByKey = "counter", StringKey = "string";
void IDisposable.Dispose()
{
mgr?.Dispose();
......@@ -165,6 +165,39 @@ public async Task<int> ExecuteGeoRadiusAsync()
}
return total;
}
/// <summary>
/// Run StringSet lots of times
/// </summary>
#if TEST_BASELINE
[Benchmark(Description = "StringSet:v1/a", OperationsPerInvoke = COUNT)]
#else
[Benchmark(Description = "StringSet:v2/a", OperationsPerInvoke = COUNT)]
#endif
public void StringSet()
{
for (int i = 0; i < COUNT; i++)
{
db.StringSet(StringKey, "hey");
}
}
/// <summary>
/// Run StringGet lots of times
/// </summary>
#if TEST_BASELINE
[Benchmark(Description = "StringGet:v1/a", OperationsPerInvoke = COUNT)]
#else
[Benchmark(Description = "StringGet:v2/a", OperationsPerInvoke = COUNT)]
#endif
public void StringGet()
{
for (int i = 0; i < COUNT; i++)
{
db.StringGet(StringKey);
}
}
}
#pragma warning disable CS1591
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment