   [.net] Tips for profiling a.NET app?
  I've got no real experience with performance tuning applications (outside of SQL Server), especially those written in .NET - so I apologise if this is obvious.I've written a virtual machine in C# that's implemented in a similar way to the C++ reference implementation. If found that in normal use, it's approximately 1.5x slower than the reference implementation running the same bytecode - at the 'worst' case I've found it running 3x slower than the original. I'm getting to the point where the VM is almost feature complete and before I go ahead and implement the glut of the standard libraries for the language I want to start thinking about finding and fixing the major performance bottlenecks in the app before I find that I have to make major structural changes later on.... the problem is, I have no idea how to go about finding these slow parts short of wrapping everything in some logging classes. I want to find if there's specific slow operations or methods in the code, or if too many objects are being copied around or being needlessly allocated. To make it more difficult, I'm using VS C# 2008 Express, so don't have the Pro edition of Visual Studio - if that makes a difference.I would appreciate your tips and ideas.   
  Right now the free tools available are CLR Profiler and NProf. The former is pretty good, and the latter is poor but usable. (I'm working on a replacement for NProf but it won't be ready for a few months, although previews might be available sooner.) CLR Profiler gives a detailed view of the memory patterns of your application. NProf is a simple sampling based profiler that will give you rough function timings. NProf isn't a powerful tool by any means, but I've managed to use it to speed up applications quite heavily even despite that.   ;  Thanks, I'll take a look at these   