<p>I just wonder what options there are to properly measure/profile/optimize ASP.net 2.0 Web Parts, especially the ones for Sharepoint 2007?</p>

<p>As Web Parts are a layer on another layer of technology, getting resource usage, open handles and stuff only for the web part seems to be a bit difficult.</p>

<p>Does anyone know some good tools or practices for profiling and optimizing web parts?</p>

I have found seperating out all the business logic in to a seperate DLL that is easily unit testable has been the easiest method for me.  But to be honest there is really no good way that I have found, besides what I have just mentioned.  The same has been true for me with Facebook applications recently.  I think this is common for any application that runs inside of another platform.  Especially when performance and testing where never a goal when the platform developers started to build the system.