facebook / fbghc
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,039 units with 14,286 lines of code in units (3.0% of code).
    • 10 very long units (2,141 lines of code)
    • 35 long units (2,253 lines of code)
    • 131 medium size units (4,164 lines of code)
    • 168 small units (2,456 lines of code)
    • 695 very small units (3,272 lines of code)
14% | 15% | 29% | 17% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c18% | 16% | 31% | 17% | 16%
py0% | 20% | 25% | 16% | 37%
h0% | 0% | 5% | 18% | 76%
pl0% | 0% | 63% | 36% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
rts19% | 13% | 30% | 17% | 18%
utils0% | 62% | 16% | 8% | 12%
testsuite0% | 20% | 26% | 16% | 37%
driver0% | 0% | 57% | 22% | 20%
libraries0% | 0% | 11% | 22% | 66%
distrib0% | 0% | 63% | 36% | 0%
includes0% | 0% | 0% | 20% | 79%
compiler0% | 0% | 0% | 58% | 41%
ghc0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
713 132 2
287 65 1
226 42 4
171 9 1
140 2 3
133 1 1
128 52 2
121 1 1
118 3 1
104 46 1
97 30 2
86 16 2
82 14 2
80 21 6
79 17 3
74 9 5
72 17 1
72 27 1
71 10 1
70 13 4
70 33 5
68 1 1
67 11 1
66 11 3
64 28 8
64 24 2
63 13 4
62 16 1
62 8 1
59 18 1
58 10 3
57 7 1
57 20 2
56 9 1
56 7 5
56 19 7
56 18 3
55 11 4
55 19 5
54 9 1
54 8 3
54 12 1
53 1 4
53 11 1
51 8 2
50 12 4
50 9 3
50 8 2
49 9 1
48 9 5