perf: 增加预热方法
This commit is contained in:
parent
0b3635b3c3
commit
5b8b47df5e
|
|
@ -10,6 +10,7 @@ using IP2Region.Net.XDB;
|
|||
|
||||
namespace IP2Region.Net.BenchMark;
|
||||
|
||||
[MemoryDiagnoser]
|
||||
public class Benchmarks
|
||||
{
|
||||
private static readonly string XdbPathV4 = Path.Combine(AppContext.BaseDirectory, "IP2Region", "ip2region_v4.xdb");
|
||||
|
|
@ -24,6 +25,17 @@ public class Benchmarks
|
|||
private readonly string _testIPv4Address = "114.114.114.114";
|
||||
private readonly string _testIPv6Address = "240e:3b7:3272:d8d0:db09:c067:8d59:539e";
|
||||
|
||||
public Benchmarks()
|
||||
{
|
||||
_contentV4Searcher.Search(_testIPv4Address);
|
||||
_vectorV4Searcher.Search(_testIPv4Address);
|
||||
_fileV4Searcher.Search(_testIPv4Address);
|
||||
|
||||
_contentV6Searcher.Search(_testIPv6Address);
|
||||
_vectorV6Searcher.Search(_testIPv6Address);
|
||||
_fileV6Searcher.Search(_testIPv6Address);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("IPv4")]
|
||||
public void ContentIPv4() => _contentV4Searcher.Search(_testIPv4Address);
|
||||
|
|
|
|||
Loading…
Reference in New Issue