microsoft / OpenXR-MixedReality
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 3,407 units with 39,829 lines of code in units (45.6% of code).
    • 39 very long units (5,861 lines of code)
    • 113 long units (7,774 lines of code)
    • 363 medium size units (11,308 lines of code)
    • 416 small units (6,135 lines of code)
    • 2,476 very small units (8,751 lines of code)
14% | 19% | 28% | 15% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h13% | 15% | 25% | 14% | 31%
cpp25% | 29% | 20% | 12% | 11%
inl11% | 23% | 41% | 18% | 5%
hpp0% | 0% | 23% | 34% | 41%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
shared/ext19% | 22% | 27% | 12% | 17%
shared/ext/DirectXMath10% | 23% | 35% | 18% | 11%
shared/SampleShared/DirectXTK67% | 17% | 5% | 5% | 4%
shared/ext/rapidjson13% | 11% | 26% | 15% | 34%
shared/XrSceneLib11% | 21% | 20% | 19% | 26%
shared/ext/fmt0% | 12% | 20% | 16% | 50%
shared/pbr0% | 18% | 35% | 21% | 24%
shared/gltf0% | 16% | 54% | 23% | 4%
shared/XrUtility0% | 7% | 21% | 20% | 50%
shared/SampleShared0% | 0% | 43% | 29% | 27%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
bool TinyGLTF::LoadFromString()
in shared/ext/tiny_gltf.h
554 123 7
HRESULT CreateTextureFromDDS()
in shared/SampleShared/DirectXTK/DDSTextureLoader.cpp
370 91 3
void ParseNumber()
in shared/ext/rapidjson/reader.h
235 93 2
HRESULT CreateD3DResources()
in shared/SampleShared/DirectXTK/DDSTextureLoader.cpp
211 33 15
inl
inline bool XM_CALLCONV Intersects()
in shared/ext/DirectXMath/Inc/DirectXCollision.inl
192 40 6
inline DXGI_FORMAT GetDXGIFormat()
in shared/SampleShared/DirectXTK/LoaderHelpers.h
183 52 1
170 57 8
static int stbi__parse_png_file()
in shared/ext/stb_image.h
153 84 3
static void stbi__idct_simd()
in shared/ext/stb_image.h
151 1 3
inl
inline bool BoundingFrustum::Intersects()
in shared/ext/DirectXMath/Inc/DirectXCollision.inl
150 12 1
inl
inline XMVECTOR XM_CALLCONV XMQuaternionRotationMatrix()
in shared/ext/DirectXMath/Inc/DirectXMathMisc.inl
150 4 1
HRESULT DirectX::SHProjectCubeMap()
in shared/ext/DirectXMath/SHMath/DirectXSHD3D11.cpp
148 39 6
static int stbi_write_jpg_core()
in shared/ext/stb_image_write.h
148 23 6
147 1 2
static void SerializeGltfModel()
in shared/ext/tiny_gltf.h
147 29 2
inline size_t BitsPerPixel()
in shared/SampleShared/DirectXTK/LoaderHelpers.h
146 124 1
static tbool GenerateTSpaces()
in shared/ext/mikktspace.cpp
130 39 7
inline void GetSurfaceInfo()
in shared/SampleShared/DirectXTK/LoaderHelpers.h
129 44 6
129 30 2
static void stbi__idct_simd()
in shared/ext/stb_image.h
129 1 3