Advertisement
DerSkythe

Untitled

Sep 17th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.97 KB | None | 0 0
  1. const string clientAccount = "3801000BL040264";
  2.  
  3.             bool firstRun = true;
  4.             var minMax = OracleInternetBank.OracleDb.Instance.GetMinMax(clientAccount);
  5.             var rawList = OracleInternetBank.OracleDb.Instance.ListBolcardInvoiceLinq(clientAccount);
  6.  
  7.             var stopWatch = new Stopwatch();
  8.  
  9.             for (int j = 0; j < 5; j++)
  10.             {
  11.                 if (firstRun)
  12.                 {
  13.                     for (int i = 0; i < 5; i++)
  14.                     {
  15.                         GetForeachResult(clientAccount, rawList, minMax);
  16.                     }
  17.  
  18.                     Console.WriteLine("Warm up finish");
  19.                 }
  20.                 stopWatch.Start();
  21.  
  22.                 for (int i = 0; i < 50; i++)
  23.                 {
  24.                     GetForeachResult(clientAccount, rawList, minMax);
  25.                 }
  26.  
  27.                 stopWatch.Stop();
  28.                 TimeSpan ts = stopWatch.Elapsed;
  29.  
  30.                 Console.WriteLine(String.Format("Foreach: {0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10));
  31.  
  32.                 GC.Collect();
  33.  
  34.                 if (firstRun)
  35.                 {
  36.                     for (int i = 0; i < 5; i++)
  37.                     {
  38.                         GetLinqResult(clientAccount, rawList, minMax);
  39.                     }
  40.  
  41.                     Console.WriteLine("Warm up finish");
  42.                 }
  43.                 stopWatch.Start();
  44.  
  45.                 for (int i = 0; i < 50; i++)
  46.                 {
  47.                     GetLinqResult(clientAccount, rawList, minMax);
  48.                 }
  49.                 stopWatch.Stop();
  50.                 ts = stopWatch.Elapsed;
  51.                 Console.WriteLine(String.Format("LINQ: {0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10));
  52.                 firstRun = false;
  53.  
  54.                 GC.Collect();
  55.             }
  56.  
  57.  
  58.             Console.WriteLine("Finished.");
  59.             Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement