facebookincubator / Portal-Kernel
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 401,362 units with 8,417,864 lines of code in units (57.3% of code).
    • 7,599 very long units (1,223,601 lines of code)
    • 25,495 long units (1,733,542 lines of code)
    • 90,887 medium size units (2,849,153 lines of code)
    • 103,763 small units (1,540,232 lines of code)
    • 173,618 very small units (1,071,336 lines of code)
14% | 20% | 33% | 18% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c14% | 21% | 34% | 18% | 11%
h3% | 2% | 10% | 17% | 66%
pl26% | 16% | 29% | 16% | 11%
py23% | 11% | 19% | 20% | 24%
cc0% | 25% | 35% | 23% | 14%
inl0% | 0% | 0% | 0% | 100%
uc0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
drivers15% | 21% | 34% | 17% | 10%
fs18% | 23% | 32% | 16% | 10%
arch9% | 13% | 31% | 22% | 22%
sound13% | 21% | 34% | 19% | 11%
net11% | 19% | 37% | 18% | 12%
tools12% | 19% | 33% | 19% | 15%
kernel6% | 11% | 32% | 25% | 23%
scripts24% | 16% | 29% | 17% | 12%
lib18% | 17% | 31% | 19% | 13%
security10% | 19% | 36% | 18% | 15%
crypto13% | 15% | 33% | 20% | 16%
mm5% | 18% | 35% | 23% | 17%
block4% | 17% | 35% | 23% | 20%
virt6% | 9% | 31% | 27% | 23%
ipc10% | 21% | 26% | 21% | 20%
include<1% | <1% | 5% | 12% | 80%
init10% | 22% | 31% | 17% | 18%
usr0% | 35% | 43% | 14% | 6%
firmware0% | 75% | 0% | 8% | 16%
certs0% | 0% | 83% | 16% | 0%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
4224 1 1
3202 1 1
2768 134 2
2349 6 2
2136 1 3
1940 255 4
1836 7 3
1479 1 3
1394 246 1
1319 1 3
1239 319 6
1235 12 1
1210 191 2
1158 139 3
1158 5 1
1147 194 3
1145 1138 2
1088 155 4
1051 408 0
1010 196 1
968 1 3
962 194 3
929 148 4
908 258 3
894 253 2
857 1 1
849 171 3
843 150 1
836 831 2
818 32 1
806 184 3
799 227 4
771 210 4
767 767 2
758 182 2
749 139 1
729 1 1
724 716 2
698 55 1
693 686 2
679 672 2
677 670 2
671 1 3
666 125 3
664 125 3
664 152 1
660 174 3
649 58 4
648 125 2
646 136 1