fork(7) download
  1. using System;
  2. using System.Diagnostics;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var tests = 1234567890;
  9. var value = 123456789235;
  10. var sw = new Stopwatch();
  11.  
  12. sw.Restart();
  13. Test1(tests, value);
  14. sw.Stop();
  15. Console.WriteLine(sw.ElapsedMilliseconds);
  16.  
  17. sw.Restart();
  18. Test2(tests, value);
  19. sw.Stop();
  20. Console.WriteLine(sw.ElapsedMilliseconds);
  21. }
  22.  
  23. static void Test1(long n, long value)
  24. {
  25. var temp = 0d;
  26. for (var i = 0; i < n; i++)
  27. temp = value >> 1;
  28. }
  29.  
  30. static void Test2(long n, long value)
  31. {
  32. var temp = 0d;
  33. for (var i = 0; i < n; i++)
  34. temp = value * 0.5;
  35. }
  36. }
Success #stdin #stdout 3.59s 131520KB
stdin
Standard input is empty
stdout
1022
2558