microsoft / DirectXTK12
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 1,678 units with 24,331 lines of code in units (47.2% of code).
    • 30 very long units (5,757 lines of code)
    • 54 long units (3,699 lines of code)
    • 170 medium size units (5,447 lines of code)
    • 243 small units (3,594 lines of code)
    • 1,181 very small units (5,834 lines of code)
23% | 15% | 22% | 14% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp27% | 19% | 25% | 12% | 15%
h19% | 5% | 16% | 22% | 35%
inl0% | 3% | 10% | 13% | 73%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Src24% | 16% | 25% | 15% | 17%
Audio34% | 17% | 20% | 10% | 17%
Inc0% | 4% | 7% | 17% | 70%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
466 102 5
bool DirectX::IsValid()
in Audio/SoundCommon.cpp
375 84 1
HRESULT WaveBankReader::Impl::Open()
in Audio/WaveBankReader.cpp
343 69 1
297 84 4
283 89 6
280 72 9
HRESULT CreateTextureFromWIC()
in Src/WICTextureLoader.cpp
270 66 8
HRESULT CreateTextureFromDDS()
in Src/DDSTextureLoader.cpp
228 56 3
206 20 5
199 56 1
173 28 1
172 32 4
169 37 3
HRESULT AudioEngine::Impl::Reset()
in Audio/AudioEngine.cpp
160 26 2
159 57 5
HRESULT CreateTextureFromDDS()
in Src/XboxDDSTextureLoader.cpp
159 44 3
158 20 0
inline size_t BitsPerPixel()
in Src/LoaderHelpers.h
155 134 1
unsigned int GetInputLayoutDesc()
in Src/ModelLoadSDKMESH.cpp
149 47 1
inline HRESULT GetSurfaceInfo()
in Src/LoaderHelpers.h
143 52 6