facebook / hhvm
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 37,881 units with 478,813 lines of code in units (45.6% of code).
    • 433 very long units (79,780 lines of code)
    • 1,095 long units (74,562 lines of code)
    • 3,859 medium size units (120,185 lines of code)
    • 5,715 small units (82,892 lines of code)
    • 26,779 very small units (121,394 lines of code)
16% | 15% | 25% | 17% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp17% | 18% | 27% | 17% | 18%
rs17% | 11% | 23% | 17% | 30%
h8% | 2% | 10% | 13% | 63%
php14% | 7% | 18% | 20% | 37%
cc6% | 8% | 31% | 21% | 30%
py7% | 9% | 23% | 26% | 32%
c3% | 10% | 37% | 25% | 22%
hack0% | 32% | 19% | 11% | 35%
pl0% | 0% | 0% | 70% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
hphp/runtime17% | 16% | 25% | 17% | 23%
hphp/hack16% | 11% | 23% | 17% | 30%
hphp/hhbbc21% | 22% | 24% | 14% | 17%
hphp/tools26% | 17% | 23% | 15% | 17%
hphp/zend40% | 14% | 21% | 13% | 10%
hphp/compiler38% | 22% | 23% | 6% | 8%
hphp/vixl5% | 6% | 25% | 19% | 42%
hphp/util1% | 12% | 24% | 20% | 40%
hphp/hsl3% | 4% | 21% | 36% | 33%
hphp/neo21% | 0% | 48% | 18% | 11%
hphp/system0% | 4% | 11% | 19% | 64%
hphp/hhvm0% | 57% | 17% | 9% | 15%
hphp/doc0% | 0% | 0% | 70% | 29%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
1230 94 6
1206 693 1
902 1 3
857 1 0
736 2 0
731 331 5
731 331 5
731 331 5
731 331 5
685 21 4
680 670 1
677 670 1
672 132 2
662 140 1
491 36 2
484 136 2
478 20 2
473 126 3
466 52 2
443 112 6
438 26 6
427 103 2
388 18 10
387 104 2
386 60 4
378 89 2
377 90 7
376 2 2
376 126 6
374 1 3
374 1 3
367 18 6
365 133 4
354 102 7
343 18 2
332 124 2
332 30 5
331 1 0
320 1 0
319 1 3
318 85 6
312 114 5
307 126 2
305 82 9
303 55 4
302 55 0
296 87 1
294 65 2
290 280 2
290 280 1