facebookincubator / hsthrift
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 670 units with 6,205 lines of code in units (19.4% of code).
    • 1 very long units (103 lines of code)
    • 10 long units (693 lines of code)
    • 65 medium size units (2,006 lines of code)
    • 93 small units (1,329 lines of code)
    • 501 very small units (2,074 lines of code)
1% | 11% | 32% | 21% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp17% | 11% | 28% | 16% | 25%
py0% | 12% | 34% | 23% | 29%
c0% | 0% | 100% | 0% | 0%
h0% | 0% | 11% | 8% | 80%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
server/cpp67% | 0% | 0% | 0% | 32%
build/fbcode_builder0% | 12% | 35% | 23% | 29%
cpp-channel/cpp0% | 23% | 38% | 21% | 16%
common/util0% | 0% | 17% | 12% | 70%
serialization0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
103 16 6
80 29 4
78 1 1
78 7 0
77 13 3
72 19 2
69 9 5
64 23 4
63 1 1
57 1 2
55 1 2
50 12 4
47 5 0
47 6 3
46 8 2
44 16 3
43 6 3
43 10 2
41 5 1
41 9 1
41 17 1
40 19 2
39 12 0
39 11 4
39 5 0
38 6 3
37 6 3
37 17 5
35 14 3
33 9 3
33 1 1
33 2 1
33 4 3
32 8 3
32 3 1
32 4 3
31 4 1
31 12 3
31 11 4
31 1 2
30 4 1
29 9 2
29 10 3
29 11 2
29 3 1
29 6 3
28 6 2
27 8 3
27 9 2
27 8 3