microsoft / referencesource
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 158,420 units with 2,120,190 lines of code in units (66.6% of code).
    • 1,493 very long units (257,837 lines of code)
    • 4,438 long units (300,930 lines of code)
    • 19,968 medium size units (612,716 lines of code)
    • 29,595 small units (430,298 lines of code)
    • 102,926 very small units (518,409 lines of code)
12% | 14% | 28% | 20% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs11% | 14% | 28% | 20% | 24%
vb29% | 21% | 22% | 13% | 13%
js9% | 12% | 31% | 19% | 27%
pl0% | 55% | 23% | 0% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
System.Data18% | 12% | 25% | 18% | 24%
System.Web.DataVisualization47% | 20% | 16% | 7% | 7%
mscorlib12% | 12% | 27% | 21% | 26%
System13% | 17% | 29% | 17% | 22%
System.Web11% | 15% | 28% | 18% | 26%
System.Xml15% | 17% | 27% | 17% | 20%
System.ServiceModel5% | 12% | 32% | 24% | 26%
Microsoft.VisualBasic29% | 21% | 22% | 13% | 13%
System.Data.Entity6% | 13% | 28% | 22% | 28%
System.Workflow.ComponentModel11% | 16% | 31% | 20% | 20%
System.Web.Mobile13% | 16% | 30% | 20% | 19%
Microsoft.CSharp17% | 19% | 27% | 16% | 18%
System.Workflow.Activities11% | 11% | 26% | 16% | 33%
System.IdentityModel9% | 19% | 31% | 16% | 21%
System.Data.Linq12% | 12% | 26% | 21% | 27%
System.Core6% | 10% | 28% | 25% | 29%
System.Configuration19% | 13% | 22% | 17% | 27%
System.Data.SqlXml7% | 11% | 33% | 19% | 28%
System.Runtime.Serialization4% | 14% | 28% | 24% | 27%
System.Activities3% | 11% | 34% | 24% | 26%
System.Web.Extensions6% | 10% | 33% | 21% | 27%
System.Activities.Presentation2% | 9% | 32% | 29% | 26%
System.ServiceModel.Activities5% | 13% | 35% | 24% | 21%
System.Activities.Core.Presentation7% | 15% | 32% | 23% | 20%
System.Web.Services7% | 21% | 32% | 15% | 23%
System.WorkflowServices8% | 15% | 36% | 18% | 20%
System.Data.Entity.Design11% | 15% | 25% | 24% | 23%
System.ServiceModel.Web8% | 18% | 30% | 22% | 19%
System.ServiceModel.Internals8% | 7% | 36% | 25% | 22%
inc20% | 12% | 29% | 17% | 20%
System.Workflow.Runtime4% | 13% | 38% | 23% | 19%
System.Messaging10% | 15% | 24% | 15% | 33%
System.Numerics9% | 8% | 34% | 27% | 20%
XamlBuildTask10% | 20% | 39% | 16% | 12%
System.ServiceModel.Activation4% | 13% | 29% | 26% | 25%
System.Data.DataSetExtensions22% | 0% | 22% | 24% | 30%
System.Runtime.DurableInstancing5% | 10% | 35% | 18% | 29%
System.Net3% | 25% | 31% | 19% | 19%
System.Web.Routing16% | 20% | 21% | 19% | 22%
xsd14% | 37% | 29% | 11% | 7%
aspnet_compiler39% | 14% | 24% | 9% | 12%
System.ServiceProcess7% | 21% | 31% | 20% | 19%
System.Activities.DurableInstancing3% | 21% | 27% | 26% | 20%
System.IdentityModel.Selectors5% | 9% | 26% | 15% | 42%
System.ServiceModel.Channels2% | 4% | 36% | 24% | 32%
System.Xml.Linq2% | 2% | 32% | 29% | 34%
System.Web.Entity3% | 15% | 32% | 25% | 23%
Microsoft.Bcl0% | 11% | 27% | 20% | 40%
System.Web.Entity.Design0% | 16% | 30% | 28% | 24%
System.ServiceModel.Discovery0% | 3% | 32% | 26% | 37%
System.ServiceModel.Routing0% | 10% | 35% | 28% | 25%
Microsoft.Activities.Build0% | 35% | 37% | 17% | 9%
System.Configuration.Install0% | 23% | 43% | 15% | 18%
System.Runtime.Caching0% | 9% | 39% | 25% | 25%
System.Web.DynamicData0% | 3% | 25% | 26% | 44%
System.Device0% | 10% | 37% | 27% | 25%
System.ComponentModel.DataAnnotations0% | 6% | 26% | 27% | 38%
regexes0% | 55% | 23% | 0% | 20%
SMDiagnostics0% | 0% | 41% | 24% | 34%
System.ServiceModel.WasHosting0% | 0% | 40% | 19% | 39%
System.Web.ApplicationServices0% | 0% | 45% | 15% | 39%
System.Xaml.Hosting0% | 0% | 46% | 26% | 27%
Microsoft.Bcl.Async0% | 0% | 10% | 32% | 57%
regcomp0% | 0% | 0% | 61% | 38%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
internal SqlInternalConnectionTds()
in System.Data/fx/src/data/System/Data/SqlClient/SqlInternalConnectionTds.cs
1687 355 13
internal SqlInternalConnectionTds()
in System.Data/System/Data/SqlClient/SqlInternalConnectionTds.cs
1683 353 13
int yyparse()
in System.Data.Entity/System/Data/Common/EntitySql/CqlParser.cs
1439 261 0
internal static RegexReplacement ParseReplacement()
in System/regex/system/text/regularexpressions/RegexParser.cs
1410 479 5
private bool TryReadInternal()
in System.Data/System/Data/SqlClient/SqlDataReader.cs
1309 317 2
private bool TryReadInternal()
in System.Data/fx/src/data/System/Data/SqlClient/SqlDataReader.cs
1309 317 2
override public void Close()
in System.Data/System/Data/SqlClient/SqlConnection.cs
1244 212 0
override public void Close()
in System.Data/fx/src/data/System/Data/SqlClient/SqlConnection.cs
1244 212 0
public StringBuilder Append()
in mscorlib/system/text/stringbuilder.cs
1120 217 3
private void RegisterProperties()
in System.Web.DataVisualization/Common/Utilities/CustomAttributesRegistry.cs
1070 1 0
internal void GenerateOneCode()
in System/regex/system/text/regularexpressions/RegexCompiler.cs
984 178 0
public void WriteAsyncCallback()
in System.Data/System/Data/SqlClient/TdsParserStateObject.cs
834 133 3
public void WriteAsyncCallback()
in System.Data/fx/src/data/System/Data/SqlClient/TdsParserStateObject.cs
834 133 3
private Task WriteRowSourceToServerAsync()
in System.Data/System/Data/SqlClient/SqlBulkCopy.cs
810 140 2
private Task WriteRowSourceToServerAsync()
in System.Data/fx/src/data/System/Data/SqlClient/SqlBulkCopy.cs
810 140 2
Public Overrides Function BindToMethod()
in Microsoft.VisualBasic/runtime/msvbalib/Helpers/VBBinder.vb
697 156 2
private static IPHostEntry NativeToHostEntry()
in System/net/System/Net/DNS.cs
644 124 1
internal static int InferSimpleType()
in System.Xml/System/Xml/Schema/Inference/Infer.cs
604 225 2
private void ParseDtdFromParserContext()
in System.Xml/System/Xml/Core/XmlTextReaderImpl.cs
600 131 0
private static Dictionary CreateBuiltInExprConverter()
in System.Data.Entity/System/Data/Common/EntitySql/SemanticAnalyzer.cs
542 66 0