I’ve just written an article that explains how a test setup must be done to get an high accuracy (better than 0.1ms) out of the stopwatch. I Think it should explain everything.
http://www.codeproject.com/KB/testing/stopwatch-measure-precise.aspx
More Related Contents:
- How do I measure how long a function is running?
- Best way to reverse a string
- What’s the fastest way to read a text file line-by-line?
- Is DateTime.Now the best way to measure a function’s performance? [closed]
- String vs. StringBuilder
- How slow are .NET exceptions?
- How costly is .NET reflection?
- Performance differences between debug and release builds
- C# Sort and OrderBy comparison
- How to get object size in memory? [duplicate]
- Stopwatch vs. using System.DateTime.Now for timing events [duplicate]
- Does C# optimize the concatenation of string literals?
- LINQ: Not Any vs All Don’t
- Exact time measurement for performance testing [duplicate]
- String interning in .Net Framework – What are the benefits and when to use interning
- Float vs Double Performance
- Why is LINQ .Where(predicate).First() faster than .First(predicate)?
- Performance of “direct” virtual call vs. interface call in C#
- SQLite .NET performance, how to speed up things?
- How does extern work in C#?
- How to force a number to be in a range in C#? [duplicate]
- Warm-up when calling methods in C#
- Why is processing a sorted array slower than an unsorted array?
- XmlSerializer Performance Issue when Specifying XmlRootAttribute
- When to use pointers in C#/.NET?
- When to change the Generate Serialization Assembly value?
- Slow SoapHttpClientProtocol constructor
- Fastest implementation of log2(int) and log2(float)
- Heap versus Stack allocation implications (.NET)
- Why subsequent direct method call is much faster than the first call?