.NET Framework Performance Signatures

I love Rico’s performance quizzes in general, but the last one has something especially interesting: a link to a file listing all members in the Framework and their estimated performance signatures (perf characteristic based on the number of allocations in the member).

Now, I only wish I had an fxcop rule warning me when I call some of the expensive members in loops, low on the callstack, on the UI thread, or in any other performance sensitive places.

Comments (5)

  1. Peter Ritchie says:

    You read my mind!  I was thinking more of being called on the UI thread; but similar premise…

  2. Rico Mariani included a very interesting file in his latest performance quiz post which shows all the

  3. john says:

    I’ve got an fxcop rule that does something similar to what your asking.  It looks for looping branch logic in the IL, then scans the IL in the loop for calls to "complex" properties.  Complex meaning any property that does more than just return a field.  It wouldnt be a stretch to extend this to look for other expensive members.  The only thing is the time it takes to run the rule would be fairly long on any good sized project.

  4. The new NDepend’s Level metric answer exactly your concern. See its definition here http://www.ndepend.com/Metrics.aspx#Level

    What you wish can be answered with some CQL constraints that looks like:

    WARN IF Count >0 IN SELECT METHODS OUT OF "MyApp.GUI" WHERE IsUsedBy "MyApp.GUI" AND MethodLevel < 5

    As long as tools don’t harness dynamic analysis info, there won’t be any algo that will do better than a coarse approximation. A good point however is that the CQL constraint can be refined at whim until it answers exactly the architect need. For example the following CQL constraint helps classifying low level methods between those that can be called by GUI and those that can be called by BackGroundThreadProc:

    WARN IF Count >0 IN SELECT METHODS OUT OF "MyApp.GUI" WHERE IsUsedBy "MyApp.GUI" AND IsUsedBy "MyApp.MyType.BackGroundThreadProc()" AND MethodLevel < 5

  5. Today I attended an interesting talk on Performance Signatures by Rico Mariani . According to his experience,