Tools
Sometimes, the bottleneck is well hidden, making the old school methods shown above less effective. In that case, consider using a profiler tool. These tools instrument your application in order to measure for example, execution time taken per method, which is fine in your development environment, but would slow down your production site. Following are some of the more popular tools at the time of writing:
Visual Studio Performance Profiling: If you are lucky enough to be using Visual Studio 2008 Team Systems Development Edition, or Visual Studio 2010 Ultimate or Premium, you already have access to a powerful performance profiling tool. One of its features is that for each function, it reports how much memory it allocates, how much time it takes on average, and how often it is called. Reports can be exported to CSV and XML files. Another great feature is Hotpathing, which shows which areas of your application take the most time for execution.
For a full description of the Visual...