microsoft / Detours
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 361 units with 7,429 lines of code in units (64.8% of code).
    • 9 very long units (1,820 lines of code)
    • 23 long units (1,522 lines of code)
    • 62 medium size units (1,972 lines of code)
    • 63 small units (928 lines of code)
    • 204 very small units (1,187 lines of code)
24% | 20% | 26% | 12% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp24% | 20% | 26% | 12% | 15%
h0% | 0% | 0% | 41% | 58%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src24% | 20% | 26% | 12% | 15%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
BOOL CImage::Write()
in src/image.cpp
331 64 1
294 38 5
BOOL CImage::Read()
in src/image.cpp
250 45 1
244 44 3
219 21 1
138 32 5
LONG WINAPI DetourDetach()
in src/detours.cpp
121 14 2
118 14 4
105 24 4
97 14 1
89 15 3
88 18 4
83 12 2
82 12 3
BOOL WINAPI AllocExeHelper()
in src/creatwth.cpp
80 22 4
76 10 3
72 14 5
70 19 3
70 16 3
61 21 3