mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
1) In `README.md`, we shouldn't use `c#` but `csharp` to make md recoginize it's the C# formation of codes. 2) Add 'ConfigureAwait(false)' as for the MSDN magazine usage. 3) Don't need Contribution History in README.md, because we can see the change logs in GitHub instead.
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using BenchmarkDotNet.Attributes;
|
|
using IP2Region.Models;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IP2Region.Test.Benchmark
|
|
{
|
|
[RankColumn]
|
|
public class DbSearch_Test : TestBase
|
|
{
|
|
private string RandomIP = "";
|
|
|
|
[Benchmark]
|
|
public DataBlock MemorySearch()
|
|
{
|
|
RandomIP = GetRandomIP();
|
|
return _search.MemorySearch(RandomIP);
|
|
}
|
|
|
|
[Benchmark]
|
|
public async Task<DataBlock> MemorySearch_Async()
|
|
{
|
|
RandomIP = GetRandomIP();
|
|
return await _search.MemorySearchAsync(RandomIP);
|
|
}
|
|
|
|
[Benchmark]
|
|
public DataBlock BinarySearch()
|
|
{
|
|
RandomIP = GetRandomIP();
|
|
return _search.BinarySearch(RandomIP);
|
|
}
|
|
|
|
[Benchmark]
|
|
public async Task<DataBlock> BinarySearch_Async()
|
|
{
|
|
RandomIP = GetRandomIP();
|
|
return await _search.BinarySearchAsync(RandomIP);
|
|
}
|
|
|
|
[Benchmark]
|
|
public DataBlock BtreeSearch()
|
|
{
|
|
RandomIP = GetRandomIP();
|
|
return _search.BtreeSearch(RandomIP);
|
|
}
|
|
|
|
[Benchmark]
|
|
public async Task<DataBlock> BtreeSearch_Async()
|
|
{
|
|
RandomIP = GetRandomIP();
|
|
return await _search.BtreeSearchAsync(RandomIP);
|
|
}
|
|
}
|
|
}
|