microsoft / BuildXL
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 31,033 units with 428,497 lines of code in units (69.7% of code).
    • 248 very long units (46,126 lines of code)
    • 868 long units (58,309 lines of code)
    • 4,007 medium size units (122,434 lines of code)
    • 6,409 small units (93,039 lines of code)
    • 19,501 very small units (108,589 lines of code)
10% | 13% | 28% | 21% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs10% | 13% | 28% | 21% | 26%
cpp22% | 19% | 28% | 16% | 13%
ts4% | 14% | 34% | 23% | 22%
mm27% | 57% | 5% | 8% | 0%
hpp14% | 0% | 8% | 11% | 65%
h0% | 7% | 12% | 32% | 47%
c0% | 0% | 47% | 32% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Public/Src10% | 13% | 28% | 21% | 25%
Private/Wdg13% | 15% | 14% | 27% | 29%
Private/CloudStorePlayground16% | 15% | 39% | 13% | 16%
Public/Sdk0% | 37% | 44% | 8% | 9%
Private/CloudTest0% | 0% | 18% | 46% | 35%
Shared/Npm0% | 0% | 38% | 32% | 28%
Private/InternalSdk0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public static extern NtStatus NtSetInformationFile()
in Public/Src/Cache/ContentStore/Library/FileSystem/NativeMethods.cs
2019 1 3
public bool TryParse()
in Public/Src/App/Bxl/Args.cs
1373 68 3
public static void DisplayHelp()
in Public/Src/App/Bxl/HelpText.cs
978 2 1
public abstract void DistributionWorkerChangedState()
in Public/Src/Engine/Dll/Tracing/Log.cs
756 1 6
private async Task ExecutePipStep()
in Public/Src/Engine/Scheduler/Scheduler.cs
576 105 1
private static void DoGetChildren()
in Public/Src/FrontEnd/TypeScript.Net/TypeScript.Net/Parsing/NodeWalker.cs
546 112 3
private unsafe void FindRabinChunkBoundariesInternal()
in Public/Src/Cache/ContentStore/Hashing/Chunking/RegressionChunking.cs
508 74 5
internal static async Task ProcessInternalAsync()
in Public/Src/Engine/Scheduler/Fingerprints/ObservedInputProcessor.cs
497 82 10
public SyntaxKind Scan()
in Public/Src/FrontEnd/TypeScript.Net/TypeScript.Net/Scanning/Scanner.cs
494 139 0
public abstract void DownloadToolErrorCopyFile()
in Public/Src/FrontEnd/Core/Tracing/Log.cs
491 1 5
private static T ForEachChild()
in Public/Src/FrontEnd/TypeScript.Net/TypeScript.Net/Printing/NodeWalkerEx.cs
455 109 3
private BuildXLEngineResult DoRun()
in Public/Src/Engine/Dll/Engine.cs
442 76 3
private static async Task TryCheckProcessRunnableFromCacheAsync()
in Public/Src/Engine/Scheduler/PipExecutor.cs
435 44 9
private async Task ProcessSandboxedProcessResultAsync()
in Public/Src/Engine/Processes/SandboxedProcessPipExecutor.cs
375 108 6
371 81 4
public abstract void DominoPerformanceSummary()
in Public/Src/App/Bxl/Tracing/Log.cs
362 1 31
export function forEachChild()
in Public/Src/FrontEnd/TypeScript.Net/TypeScript.Net/TypeScriptImpl/Parser.ts
350 244 2
private ConstructScheduleResult ConstructSchedule()
in Public/Src/Engine/Dll/Engine.cs
348 58 7
private void BuildTypeDisplay()
in Public/Src/FrontEnd/TypeScript.Net/TypeScript.Net/TypeChecking/SymbolDisplayBuilder.cs
346 68 5
private static async Task ExecutePipAndHandleRetryAsync()
in Public/Src/Engine/Scheduler/PipExecutor.cs
337 34 10