microsoft / DirectXTK
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,451 units with 24,250 lines of code in units (47.8% of code).
    • 29 very long units (6,681 lines of code)
    • 59 long units (4,143 lines of code)
    • 166 medium size units (5,219 lines of code)
    • 206 small units (3,056 lines of code)
    • 991 very small units (5,151 lines of code)
27% | 17% | 21% | 12% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp31% | 20% | 21% | 11% | 15%
h28% | 5% | 19% | 16% | 31%
cs0% | 7% | 47% | 35% | 10%
inl0% | 3% | 10% | 13% | 73%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Src28% | 20% | 23% | 12% | 15%
Audio34% | 17% | 20% | 10% | 17%
XWBTool76% | 11% | 6% | 5% | 1%
MakeSpriteFont0% | 7% | 47% | 35% | 10%
Inc0% | 2% | 7% | 14% | 75%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int __cdecl wmain()
in XWBTool/xwbtool.cpp
567 113 2
503 110 6
HRESULT CreateTextureFromDDS()
in Src/DDSTextureLoader.cpp
417 101 3
HRESULT CreateTextureFromWIC()
in Src/WICTextureLoader.cpp
390 100 3
bool DirectX::IsValid()
in Audio/SoundCommon.cpp
375 84 1
bool ConvertToMiniFormat()
in XWBTool/xwbtool.cpp
362 80 3
HRESULT WaveBankReader::Impl::Open()
in Audio/WaveBankReader.cpp
343 69 1
314 84 5
267 70 7
HRESULT CreateD3DResources()
in Src/DDSTextureLoader.cpp
212 33 15
206 20 5
199 56 1
188 72 3
HRESULT CreateD3DResources()
in Src/XboxDDSTextureLoader.cpp
185 27 12
172 32 4
169 37 3
164 41 3
HRESULT AudioEngine::Impl::Reset()
in Audio/AudioEngine.cpp
160 26 2
158 20 0
inline size_t BitsPerPixel()
in Src/LoaderHelpers.h
155 134 1