facebook / CacheLib
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 2,556 units with 22,416 lines of code in units (49.2% of code).
    • 2 very long units (254 lines of code)
    • 41 long units (2,652 lines of code)
    • 217 medium size units (6,529 lines of code)
    • 378 small units (5,413 lines of code)
    • 1,918 very small units (7,568 lines of code)
1% | 11% | 29% | 24% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h1% | 9% | 18% | 23% | 47%
cpp<1% | 12% | 37% | 25% | 23%
rs0% | 23% | 30% | 21% | 23%
js0% | 0% | 0% | 43% | 56%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cachelib/cachebench6% | 8% | 34% | 21% | 28%
cachelib/persistence34% | 18% | 15% | 22% | 9%
cachelib/allocator0% | 14% | 28% | 23% | 34%
cachelib/benchmarks0% | 24% | 38% | 12% | 24%
cachelib/navy0% | 5% | 32% | 26% | 34%
cachelib/compact_cache0% | 19% | 28% | 21% | 30%
cachelib/rust0% | 18% | 24% | 23% | 33%
cachelib/datatype0% | 6% | 13% | 27% | 52%
cachelib/common0% | 2% | 23% | 31% | 41%
cachelib/shm0% | 7% | 30% | 33% | 29%
cachelib/experimental0% | 0% | 20% | 33% | 46%
website/src0% | 0% | 0% | 100% | 0%
website0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
152 33 1
102 14 1
90 9 3
89 12 1
86 14 1
85 17 3
83 13 0
82 16 0
82 7 2
80 3 1
78 17 3
74 6 1
69 8 1
67 9 2
67 11 4
65 9 0
64 4 0
63 2 3
63 11 1
63 14 2
62 15 2
61 10 3
61 14 1
60 8 3
59 14 2
59 9 1
59 8 2
58 10 4
58 12 4
57 15 3
56 9 3
56 15 2
56 8 3
56 11 5
56 13 3
55 6 6
55 8 0
55 9 0
54 3 1
53 13 9
53 10 2
52 14 3
51 1 1
50 5 2
49 11 0
49 5 5
49 8 1
48 10 2
47 18 2
47 5 5