.NET Framework Allocation Complexity Graph

Published 26 January 07 10:16 AM | ricom 

A quick graphical view of how the framework measures up.

 

This graph shows the number of methods of any given allocation complexity on a logarithmic scale.  This allocation complexity is discussed in more detail in performance quiz #12 and this summary of my CMG talk on performance signatures.

Remember this is just a rough number, imperfect in many ways, it's only interesting to give you a general feeling about where particular methods are in the food-chain.  It's useful as a planning tool but not a replacement for actual measurement.  And despite the fact that I think this metric has several flaws, which I'll be discussing them in coming postings, even this feeble metric is actually useful -- an amazing result in an of itself.

Filed under: ,

Comments

# Frank Hileman said on January 26, 2007 4:47 PM:

I want to measure our library this way. Is there any tool for this? Thanks.

# ricom said on January 26, 2007 6:19 PM:

The thing that I used to make the data isn't shipped in any way.  I might be able to do something about that but I can't promise anything just yet.

Ultimately I think it would be cool if you could compute any cost you like of your own with a little library and some custom code.

# Patrick Smacchia said on January 30, 2007 4:05 PM:

The tool NDepend implements numerous interesting metrics: http://www.ndepend.com/Metrics.aspx

The Level metric: that gives you a precise idea of which method/type/namespace/assembly is high/mid or low level:

http://www.ndepend.com/Metrics.aspx#Level

SELECT TYPES ORDER BY TypeLevel DESC

Did you know that the method System.Xml.Xsl.XPath.XPathBuilder.ArithmeticOperator(XPathOperator,QilNode,QilNode) has a level of 18, that the average level over all methods is 2.1 and that 64.157 methods on 157.918 are involved into a dependency cycle and thus can’t have level.

SELECT METHODS WHERE !HasLevel  

Metric Rank: that uses the Google PageRank algo to pinpoints the most important types and methods

http://www.ndepend.com/Metrics.aspx

Btw, it shows that the most important types of the framework are in order: ComVisibleAttribute, Object, SerializableAttribute, Boolean, CLSCompliantAttribute, Int32, GuidAttribute, String…

SELECT TYPES ORDER BY TypeRank DESC

The metric SizeOfInst that gives the memory footprint of an instance of a non-generic type:

The System.Net.NetworkInformation.SystemIcmpV6Statistics class has the biggest footprint equals to 2064 bytes.

http://www.ndepend.com/Metrics.aspx#SizeOfInst

SELECT TYPES ORDER BY SizeOfInst DESC

Many others metric are supported. Did you know that:

The following public method has 24 parameters (while a non public method has up to 38 parameters): System.Xml.Xsl.Xslt.XsltInput.GetAttributes(Int32,String,ref.String,String,ref.String,String,ref.String,String,ref.String,String,ref.String,String,ref.String,String,ref.String,String,ref.String,String,ref.String,String,ref.String)

SELECT METHODS WHERE IsPublic ORDER BY NbParameters  DESC

The following public methods has 3112 IL instructions (around 500 lines of C# code)  (while a non public method has up to 5294 IL instructions)

System.Web.RegularExpressions.TagRegexRunner1.Go()

SELECT METHODS WHERE IsPublic ORDER BY NbILInstructions DESC

The following type has a depth of inheritance equal to 11:

System.Web.UI.Design.WebControls.AccessDataSourceWizardForm

SELECT TYPES ORDER BY DepthOfInheritance DESC

The type DataGridView is directly using 343 other types and indirectly depends on 6414 types.

SELECT TYPES ORDER BY TypeCe DESC

SELECT TYPES WHERE IsUsedBy "System.Windows.Forms.DataGridView" ORDER BY DepthOfIsUsedBy

1420 methods of the assembly System are using 6814 methods of the assembly mscorlib.

All these info and much more are available at a glance thanks to the language Code Query Language (CQL). I’ll be at Redmond during the MVP summit in March 2007 to present the tool NDepend and CQL. You can have a glance at online demo available on http://www.NDepend.com to see how NDepend can dramatically helps developers in daily scenarios.

The log allocation complexity metric is indeed meaningful and I put it in my TODO list.

# Rico Mariani's Performance Tidbits said on February 7, 2007 2:18 PM:

I presented this paper at the CMG 2006 conference. I've previously posted the content of my slides and

# Rico Mariani's Performance Tidbits said on February 16, 2007 4:39 PM:

Several people here (you know who you are) have been nagging me to do an analysis similar to the one

# Rico Mariani's Performance Tidbits said on March 22, 2007 4:00 PM:

Well it seems like an eternity ago but at last I'm writing the followup to my initial question about

# All Your Base Are Belong To Us said on December 27, 2007 3:05 PM:

To rephrase this post (or rant) in a nutshell: Measuring performance is not as simple as people think

New Comments to this post are disabled

Search

This Blog

Syndication

Page view tracker