Advertisement
Guest User

Parse Performance Test

a guest
May 29th, 2010
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.31 KB | None | 0 0
  1. long l;
  2. string strLong = "1";
  3.  
  4. Stopwatch s = new Stopwatch();
  5. s.Start();
  6. for(int i = 0; i < 10000000; i++) {
  7.     long.TryParse(strLong, out l);
  8. }
  9. s.Stop();
  10. s.ElapsedMilliseconds.Dump("Try Parse:");
  11. s.Restart();
  12. for(int i = 0; i < 10000000; i++) {
  13.     long.Parse(strLong);
  14. }
  15. s.ElapsedMilliseconds.Dump("Parse:");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement