Every once in a while, there comes a time when some chunk of code that you have written isn't performing quite as well as you think it should. And when that time comes, you need to have a way of figuring out what parts of your code are causing those performance problems. For the heavy duty cases, there are full blown code profiler programs out there, but for the simpler cases you probably just want to time some segments of code manually. And that is what we are going to take a look at today. A couple of times in various articles in the blog, we have used the value from Environment.TickCount to help determine how long a segment of code took to run. This is quick and painless, but it doesn't give you very high resolution. Even though TickCount here return values that equate to milliseconds, it doesn't actually give you millisecond resolution for time - the best resolution it will give you is 10 milliseconds. For example, I ran the following code on my computer...