microsoft / Win2D
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 5,314 units with 53,964 lines of code in units (47.4% of code).
    • 18 very long units (3,407 lines of code)
    • 52 long units (3,299 lines of code)
    • 396 medium size units (11,797 lines of code)
    • 1,192 small units (17,101 lines of code)
    • 3,656 very small units (18,360 lines of code)
6% | 6% | 21% | 31% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h11% | 2% | 8% | 18% | 58%
cpp2% | 6% | 26% | 39% | 24%
cs9% | 13% | 36% | 27% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
winrt/lib7% | 5% | 22% | 40% | 23%
winrt/test.internal3% | 4% | 14% | 17% | 59%
winrt/test.managed12% | 11% | 40% | 24% | 10%
tools/codegen11% | 22% | 30% | 19% | 15%
winrt/test.external0% | 3% | 23% | 32% | 41%
tools/mock0% | 26% | 40% | 21% | 11%
tools/exportsample0% | 0% | 29% | 50% | 20%
winrt/inc0% | 0% | 11% | 15% | 72%
tools/checkcode0% | 0% | 45% | 35% | 19%
tools/shared0% | 0% | 35% | 47% | 16%
winrt/test.nativecomponent0% | 0% | 0% | 26% | 73%
winrt/published0% | 0% | 0% | 37% | 62%
winrt/dll0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
class CanvasDrawingSession : RESOURCE_WRAPPER_RUNTIME_CLASS()
in winrt/lib/drawing/CanvasDrawingSession.h
1066 2 5
294 1 4
class CanvasGeometry : RESOURCE_WRAPPER_RUNTIME_CLASS()
in winrt/lib/geometry/CanvasGeometry.h
223 2 6
149 1 4
IFACEMETHODIMP CanvasTextAnalyzer::GetGlyphsWithAllOptions()
in winrt/lib/text/CanvasTextAnalyzer.cpp
142 11 17
140 4 7
bool CanvasAnimatedControl::Tick()
in winrt/lib/xaml/CanvasAnimatedControl.cpp
139 36 2
static void TestComputeHistogram()
in winrt/test.internal/graphics/CanvasImageUnitTests.cpp
137 10 1
object GetArbitraryTestValue()
in winrt/test.managed/EffectTests.cs
129 32 2
static object Unbox()
in winrt/test.managed/EffectTests.cs
124 17 2
void VerifyCommonBrushProperties()
in winrt/test.internal/graphics/CanvasImageBrushUnitTests.cpp
116 1 3
unsigned GetBytesPerBlock()
in winrt/lib/utils/DxgiUtilities.cpp
114 100 1
public static void OutputEffectCpp()
in tools/codegen/exe/OutputEffectType.cs
108 11 2
void ExpectGetGlyphs()
in winrt/test.internal/graphics/CanvasTextAnalyzerUnitTests.cpp
107 7 2
static object Box()
in winrt/test.managed/EffectTests.cs
106 17 2
public static void OutputEffectIdl()
in tools/codegen/exe/OutputEffectType.cs
105 15 2
class CanvasSwapChain : RESOURCE_WRAPPER_RUNTIME_CLASS()
in winrt/lib/drawing/CanvasSwapChain.h
104 1 7
void DrawGlyphRunTestCase()
in winrt/test.internal/graphics/CanvasTextRendererUnitTests.cpp
104 6 2
98 2 4
public static void OutputEffectHeader()
in tools/codegen/exe/OutputEffectType.cs
91 14 2