Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Int64 ReturnDifferenceA()
- {
- User[] arrayList;
- Int64 firstTicks;
- IList<User> userList;
- Int64 secondTicks;
- System.Diagnostics.Stopwatch watch;
- userList = Enumerable
- .Range(0, 1000)
- .Select(currentItem => new User()).ToList();
- arrayList = userList.ToArray();
- watch = new Stopwatch();
- watch.Start();
- for (Int32 loopCounter = 0; loopCounter < arrayList.Count(); loopCounter++)
- {
- DoThings(arrayList[loopCounter]);
- }
- watch.Stop();
- firstTicks = watch.ElapsedTicks;
- watch.Reset();
- watch.Start();
- for (Int32 loopCounter = 0; loopCounter < arrayList.Count(); loopCounter++)
- {
- DoThings(arrayList[loopCounter]);
- }
- watch.Stop();
- secondTicks = watch.ElapsedTicks;
- return firstTicks - secondTicks;
- }
- differenceList = Enumerable
- .Range(0, 50)
- .Select(currentItem => ReturnDifferenceA()).ToList();
- average = differenceList.Average();
- differenceListA = Enumerable
- .Range(0, 50)
- .Select(currentItem => ReturnDifferenceA()).ToList();
- averageA = differenceListA.Average();
- differenceListB = Enumerable
- .Range(0, 50)
- .Select(currentItem => ReturnDifferenceA()).ToList();
- averageB = differenceListB.Average();
Add Comment
Please, Sign In to add comment