时间:2021-07-01 10:21:17 帮助过:39人阅读
Stopwatch stopwatch = new Stopwatch();
List<string> ips = new List<string> { "218.5.3.128", "120.67.217.7", "125.78.67.175", "220.250.64.23", "218.5.3.128", "120.67.217.7", "125.78.67.175", "220.250.64.23" };
stopwatch.Start();
for (int i = 0; i < 100; i++)
{
foreach (string item in ips)
{
ip = qqWry.Query(item);
// Console.WriteLine("{0} {1} {2}", ip.IP, ip.Country, ip.Local);
}
}
stopwatch.Stop();
Console.WriteLine("QQWryLocator 花了{0} ms", stopwatch.ElapsedMilliseconds);
stopwatch.Reset();
stopwatch.Start();
for (int i = 0; i < 100; i++)
{
foreach (string item in ips)
{
string s = IPLocation.IPLocation.IPLocate("qqwry.dat", item);
// Console.WriteLine(s);
}
}
stopwatch.Stop();
Console.WriteLine("IPLocation 花了{0} ms", stopwatch.ElapsedMilliseconds);
性能比较结果:
源码和示例下载