facebook / mysql-8.0
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 66,065 units with 858,317 lines of code in units (38.3% of code).
    • 929 very long units (182,230 lines of code)
    • 2,005 long units (137,996 lines of code)
    • 6,712 medium size units (207,131 lines of code)
    • 9,776 small units (142,536 lines of code)
    • 46,643 very small units (188,424 lines of code)
21% | 16% | 24% | 16% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc22% | 19% | 28% | 16% | 13%
js16% | 15% | 24% | 18% | 24%
inc75% | 5% | 10% | 6% | 1%
c26% | 23% | 26% | 13% | 10%
cpp26% | 22% | 23% | 13% | 14%
java5% | 3% | 19% | 22% | 49%
h2% | 1% | 9% | 17% | 68%
pl23% | 16% | 29% | 16% | 13%
pm20% | 13% | 25% | 19% | 21%
hpp3% | 3% | 15% | 20% | 57%
php77% | 0% | 7% | 9% | 5%
py6% | 10% | 20% | 21% | 41%
t0% | 0% | 30% | 19% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
storage19% | 16% | 23% | 17% | 24%
sql20% | 17% | 25% | 16% | 20%
mysql-test64% | 7% | 13% | 9% | 4%
extra16% | 15% | 24% | 17% | 26%
client33% | 18% | 22% | 14% | 11%
plugin14% | 19% | 31% | 18% | 15%
rapid8% | 12% | 26% | 21% | 30%
mysys19% | 21% | 31% | 14% | 13%
strings34% | 18% | 25% | 12% | 8%
sql-common33% | 9% | 35% | 11% | 10%
mysys_ssl41% | 16% | 21% | 10% | 9%
unittest9% | 8% | 29% | 22% | 30%
include8% | 5% | 21% | 22% | 41%
utilities24% | 22% | 25% | 18% | 10%
libmysql7% | 26% | 39% | 10% | 15%
dbug17% | 10% | 40% | 19% | 11%
components10% | 14% | 44% | 14% | 15%
libbinlogevents14% | 0% | 22% | 19% | 43%
vio0% | 30% | 42% | 17% | 9%
testclients0% | 35% | 36% | 22% | 6%
packaging0% | 47% | 30% | 10% | 11%
scripts0% | 0% | 100% | 0% | 0%
win0% | 0% | 72% | 18% | 8%
cmake0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
3618 74 1
2537 7 1
2409 4 1
2048 15 4
2025 2 6
1227 2 6
1131 3 1
1026 13 1
963 225 5
808 179 2
781 13 1
767 148 5
764 222 4
728 12 1
694 168 9
677 150 5
674 123 1
624 183 3
617 189 5
594 103 9
594 172 2
591 172 2
555 120 5
552 109 9
548 211 5
537 97 3
535 125 2
523 138 1
517 1 1
512 82 1
499 124 6
491 118 5
489 108 3
488 159 5
484 3 1
472 143 13
454 146 0
446 131 3
441 156 3
440 10 1
429 86 3
426 2 3
422 117 2
417 121 3
416 127 37
414 125 14
410 103 4
409 92 2
408 120 3
402 149 3