facebook / mcrouter
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,237 units with 32,429 lines of code in units (50.3% of code).
    • 11 very long units (1,716 lines of code)
    • 56 long units (3,685 lines of code)
    • 294 medium size units (8,875 lines of code)
    • 523 small units (7,591 lines of code)
    • 2,353 very small units (10,562 lines of code)
5% | 11% | 27% | 23% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp5% | 15% | 39% | 19% | 19%
h4% | 8% | 16% | 26% | 44%
c0% | 0% | 41% | 43% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mcrouter15% | 11% | 27% | 18% | 27%
mcrouter/routes5% | 23% | 23% | 24% | 23%
mcrouter/tools/mcpiper12% | 11% | 28% | 22% | 23%
mcrouter/lib/network1% | 8% | 30% | 26% | 33%
mcrouter/lib7% | 3% | 22% | 22% | 43%
mcrouter/lib/carbon0% | 10% | 22% | 19% | 46%
mcrouter/lib/config0% | 12% | 41% | 17% | 29%
mcrouter/lib/fbi0% | 6% | 16% | 38% | 38%
mcrouter/lib/routes0% | 0% | 27% | 24% | 48%
mcrouter/lib/debug0% | 0% | 28% | 24% | 47%
mcrouter/lib/mc0% | 0% | 23% | 42% | 34%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
232 19 2
217 39 0
183 20 6
167 39 9
155 11 3
144 40 3
135 17 0
133 35 0
127 21 3
114 26 2
109 19 2
97 4 2
95 14 2
89 7 3
88 12 2
86 22 2
82 17 0
81 22 2
78 25 3
77 22 3
77 13 0
77 9 3
76 6 2
75 8 0
74 17 0
73 23 0
73 10 8
72 12 6
72 16 3
70 11 1
70 11 2
70 20 1
67 12 2
67 14 2
66 11 2
65 10 2
63 9 3
63 16 1
62 12 3
62 16 3
61 15 7
61 5 2
60 8 4
60 12 2
60 5 2
60 19 2
60 6 1
60 9 0
60 13 1
59 13 0