microsoft / Xbox-ATG-Samples
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 14,338 units with 241,098 lines of code in units (56.6% of code).
    • 420 very long units (69,255 lines of code)
    • 800 long units (53,365 lines of code)
    • 1,619 medium size units (53,466 lines of code)
    • 1,922 small units (27,326 lines of code)
    • 9,577 very small units (37,686 lines of code)
28% | 22% | 22% | 11% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp31% | 21% | 23% | 10% | 12%
h8% | 30% | 9% | 15% | 35%
c26% | 19% | 34% | 13% | 5%
inl0% | 3% | 10% | 14% | 71%
cs0% | 0% | 50% | 18% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Kits/DirectXTex55% | 19% | 18% | 3% | 1%
PCSamples/IntroGraphics42% | 23% | 16% | 7% | 10%
XDKSamples/Graphics27% | 28% | 24% | 9% | 9%
UWPSamples/IntroGraphics27% | 17% | 26% | 11% | 16%
Kits/DirectXTK1223% | 15% | 22% | 14% | 23%
Kits/DirectXTK26% | 17% | 21% | 11% | 22%
UWPSamples/System28% | 15% | 27% | 12% | 17%
XDKSamples/Tools49% | 17% | 16% | 8% | 8%
UWPSamples/Audio22% | 19% | 29% | 11% | 16%
PCSamples/Raytracing37% | 17% | 23% | 10% | 11%
XDKSamples/IntroGraphics16% | 39% | 9% | 14% | 19%
UWPSamples/Graphics26% | 17% | 28% | 12% | 14%
PCSamples/Graphics42% | 21% | 16% | 9% | 9%
XDKSamples/System7% | 35% | 21% | 15% | 20%
Kits/ATGTK16% | 9% | 27% | 17% | 28%
XDKSamples/Audio4% | 37% | 23% | 16% | 18%
UWPSamples/Tools0% | 0% | 50% | 18% | 31%
Kits/CPUTK0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int __cdecl wmain()
in XDKSamples/Tools/xtexconv/texconv.cpp
2027 408 2
void Sample::Render()
in UWPSamples/System/SystemInfoUWP/SystemInfo.cpp
1133 276 0
bool DirectX::_StoreScanline()
in Kits/DirectXTex/DirectXTexConvert.cpp
716 191 6
_Use_decl_annotations_ bool DirectX::_LoadScanline()
in Kits/DirectXTex/DirectXTexConvert.cpp
688 199 5
int ZEXPORT inflate()
in XDKSamples/Graphics/SimpleDmaDecompression/zlib/zlib-1.2.8/inflate.c
631 191 2
void DirectX::_ConvertScanline()
in Kits/DirectXTex/DirectXTexConvert.cpp
616 148 5
std::unique_ptr DirectX::Model::CreateFromCMO()
in Kits/DirectXTK/Src/ModelLoadCMO.cpp
503 110 6
std::unique_ptr DirectX::Model::CreateFromCMO()
in Kits/DirectXTK12/Src/ModelLoadCMO.cpp
466 102 5
HRESULT CreateTextureFromDDS()
in Kits/DirectXTK/Src/DDSTextureLoader.cpp
417 101 3
void SSAO::Run()
in PCSamples/Raytracing/RaytracingAO_PC12/SSAO.cpp
402 15 1
HRESULT UncompressPixels()
in Kits/DirectXTex/DirectXTexTGA.cpp
392 105 1
HRESULT CreateTextureFromWIC()
in Kits/DirectXTK/Src/WICTextureLoader.cpp
390 100 3
HRESULT DirectX::LoadFromTGAFile()
in Kits/DirectXTex/DirectXTexTGA.cpp
389 78 4
bool DirectX::IsValid()
in Kits/DirectXTK/Audio/SoundCommon.cpp
375 84 1
bool DirectX::IsValid()
in Kits/DirectXTK12/Audio/SoundCommon.cpp
375 84 1
bool DirectX::_StoreScanlineDither()
in Kits/DirectXTex/DirectXTexConvert.cpp
358 87 9
HRESULT WaveBankReader::Impl::Open()
in Kits/DirectXTK/Audio/WaveBankReader.cpp
343 69 1
HRESULT WaveBankReader::Impl::Open()
in Kits/DirectXTK12/Audio/WaveBankReader.cpp
343 69 1
class __declspec()
in Kits/ATGTK/OrbitCamera.cpp
338 86 1
int ZEXPORT inflateBack()
in XDKSamples/Graphics/SimpleDmaDecompression/zlib/zlib-1.2.8/infback.c
331 71 5