mirror of
https://github.com/netfun2000/ip2region.git
synced 2026-02-27 09:44:31 +08:00
feat(csharp): 2.0 xdb csharp client implementation
This commit is contained in:
21
binding/csharp/IP2Region.Net.BenchMark/Program.cs
Normal file
21
binding/csharp/IP2Region.Net.BenchMark/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Running;
|
||||
using IP2Region.Net.XDB;
|
||||
|
||||
BenchmarkRunner.Run(typeof(Program).Assembly);
|
||||
|
||||
public class CachePolicyCompare
|
||||
{
|
||||
private readonly Searcher _contentSearcher = new Searcher(CachePolicy.Content);
|
||||
private readonly Searcher _vectorSearcher = new Searcher(CachePolicy.VectorIndex);
|
||||
|
||||
private readonly string _testIpAddress = "114.114.114.114";
|
||||
|
||||
[Benchmark]
|
||||
[BenchmarkCategory(nameof(CachePolicy.Content))]
|
||||
public void CachePolicy_Content() => _contentSearcher.Search(_testIpAddress);
|
||||
|
||||
[Benchmark]
|
||||
[BenchmarkCategory(nameof(CachePolicy.VectorIndex))]
|
||||
public void CachePolicy_VectorIndex() => _vectorSearcher.Search(_testIpAddress);
|
||||
}
|
||||
Reference in New Issue
Block a user