Guest User

Untitled

a guest
Jun 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.Threading;
  4.  
  5. namespace wx_test
  6. {
  7. class Program
  8. {
  9. static string lettersGOOD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  10. static string lettersBAD = ".-%&?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  11.  
  12. private static void Go(string sample, int iterations)
  13. {
  14. for (int i = 0; i < iterations; i++)
  15. {
  16. sample.StartsWith("SI");
  17. }
  18. }
  19.  
  20. static void Main(string[] args)
  21. {
  22. var cult = Thread.CurrentThread.CurrentCulture;
  23. Console.WriteLine($"{cult}; {cult.CompareInfo}");
  24.  
  25. Go(lettersGOOD, 1);
  26. Go(lettersBAD, 1);
  27.  
  28. var stopwatch = Stopwatch.StartNew();
  29. Go(lettersGOOD, 1000000);
  30. stopwatch.Stop();
  31. Console.WriteLine($"GOOD: {stopwatch.Elapsed}");
  32.  
  33. stopwatch = Stopwatch.StartNew();
  34. Go(lettersBAD, 1000000);
  35. stopwatch.Stop();
  36. Console.WriteLine($"BAD: {stopwatch.Elapsed}");
  37. }
  38. }
  39. }
Add Comment
Please, Sign In to add comment