I've been interested in performance optimization from the first application I wrote and since than I been finding new ways to make my code run faster with less memory usage. Over the time I found that after discovering the existing bottlenecks in the code knowing which command takes more time to execute is always an easy win when in need of optimizing a specific code.
There are several ways to find the performance implications of different code snippets - writing a benchmark, searching the Internet and one of my favorites using measurIt.
This simple tool written by Vance Morrison from Microsoft's .NET runtime team runs several well used .NET snippets and outputs the time it took to run each snippet.
For example acquiring ReaderWriterLock takes more time then using simple lock/Monitor.Enter:
Using measureIt saved me some time and should help resolving the known argument of which command takes more time.
Labels: Performance, Tools