facebook / folly
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 11,772 units with 95,293 lines of code in units (53.2% of code).
    • 30 very long units (5,771 lines of code)
    • 128 long units (8,744 lines of code)
    • 725 medium size units (21,538 lines of code)
    • 1,467 small units (21,141 lines of code)
    • 9,422 very small units (38,099 lines of code)
6% | 9% | 22% | 22% | 39%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h5% | 4% | 15% | 20% | 53%
cpp7% | 15% | 29% | 24% | 24%
py1% | 9% | 35% | 23% | 30%
c0% | 0% | 100% | 0% | 0%
pyx0% | 0% | 23% | 13% | 62%
pyi0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
folly9% | 7% | 17% | 17% | 47%
folly/concurrency43% | 3% | 5% | 14% | 32%
folly/io6% | 11% | 24% | 25% | 31%
folly/experimental4% | 10% | 28% | 22% | 34%
folly/container6% | 7% | 15% | 18% | 52%
folly/hash13% | 23% | 12% | 24% | 26%
build/fbcode_builder2% | 11% | 36% | 22% | 28%
folly/logging0% | 33% | 22% | 26% | 17%
folly/stats0% | 16% | 19% | 17% | 45%
folly/net0% | 17% | 25% | 33% | 23%
folly/futures0% | 10% | 18% | 21% | 48%
folly/detail0% | 9% | 33% | 19% | 37%
folly/portability0% | 5% | 15% | 27% | 51%
folly/fibers0% | 2% | 23% | 33% | 40%
folly/system0% | 13% | 24% | 39% | 23%
folly/executors0% | 2% | 26% | 20% | 49%
folly/compression0% | 3% | 36% | 23% | 36%
folly/chrono0% | 23% | 58% | 11% | 5%
folly/synchronization0% | 0% | 23% | 23% | 52%
folly/gen0% | 0% | 14% | 26% | 59%
folly/ssl0% | 0% | 13% | 29% | 56%
folly/python0% | 0% | 24% | 29% | 46%
folly/support0% | 0% | 25% | 18% | 56%
folly/memory0% | 0% | 8% | 15% | 75%
folly/lang0% | 0% | 3% | 27% | 69%
folly/init0% | 0% | 53% | 0% | 46%
folly/functional0% | 0% | 0% | 26% | 73%
folly/tracing0% | 0% | 0% | 38% | 61%
folly/tools0% | 0% | 0% | 0% | 100%
folly/poly0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
963 172 1
655 72 1
453 55 1
388 70 3
179 38 6
169 25 2
165 18 1
162 18 1
160 35 1
148 26 3
143 51 4
135 38 2
132 18 6
128 13 3
125 22 7
122 18 2
118 29 3
117 17 5
116 23 5
115 18 5
114 23 2
114 28 3
113 23 5
112 26 6
109 37 0
106 20 2
105 36 4
102 22 4
102 22 4
101 34 6
99 19 2
98 18 2
97 26 1
97 24 1
96 14 0
96 19 0
94 17 0
94 29 3
93 23 1
90 23 4
90 20 1
89 8 2
89 8 2
88 16 3
86 15 0
86 31 1
85 14 2
84 20 0
83 23 4
83 21 0