[METHODE TOXIIC] Exec Time:00:00:00.1097790
[METHODE hero9910] Exec Time:00:00:00.1505206
Execution time of 50000 runs.
However single time:
[METHODE TOXIIC] Exec Time:00:00:00.0000281
[METHODE hero9910] Exec Time:00:00:00.0000274
No way is better,
both equal in speed at single run times.
Test function:
Quote:
static void Main(string[] args)
{
string res;
var stopWatch1 = new Stopwatch();
var stopWatch2 = new Stopwatch();
TimeSpan executionTime1 = new TimeSpan();
TimeSpan executionTime2 = new TimeSpan();
CookieContainer cookiecontainer = new CookieContainer();
Uri target = new Uri("http://test");
cookiecontainer.Add(new Cookie("test", "testast") { Domain = target.Host });
cookiecontainer.Add(new Cookie("NKK", "###") { Domain = target.Host });
cookiecontainer.Add(new Cookie("NPP", "NPPBLA124214124124") { Domain = target.Host });
for (int i = 0; i < 1; i++)
{
stopWatch1.Start();
foreach (Cookie cookie in cookiecontainer.GetCookies(target))
{
if (cookie.Name == "NPP")
{
res = cookie.Value;
break;
}
}
stopWatch2.Stop();
executionTime1 += stopWatch1.Elapsed;
stopWatch1.Reset();
stopWatch2.Start();
foreach (Cookie cookie in cookiecontainer.GetCookies(target))
{
if (cookie.ToString().Contains("NPP="))
{
res = cookie.ToString().Split(new char[] { '=' })[1];
break;
}
}
stopWatch2.Stop();
executionTime2 += stopWatch2.Elapsed;
stopWatch2.Reset();
}
Console.WriteLine("[METHODE TOXIIC] Exec Time:" + executionTime1);
Console.WriteLine("[METHODE hero9910] Exec Time:" + executionTime2);
Console.ReadLine();
}
|