.NET Framework Allocation Complexity Graph


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.

Comments (7)

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

  2. ricom says:

    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.

  3. 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.

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

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

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

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