hhvm / user-documentation
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 1,585 units with 16,144 lines of code in units (74.8% of code).
    • 5 very long units (648 lines of code)
    • 20 long units (1,296 lines of code)
    • 134 medium size units (3,772 lines of code)
    • 351 small units (4,724 lines of code)
    • 1,075 very small units (5,704 lines of code)
4% | 8% | 23% | 29% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
php8% | 14% | 36% | 19% | 20%
hack0% | 1% | 11% | 38% | 48%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src34% | 0% | 15% | 36% | 13%
src/markdown-extensions15% | 25% | 40% | 5% | 13%
src/build6% | 21% | 44% | 17% | 10%
src/site3% | 6% | 31% | 24% | 32%
src/api-gen0% | 46% | 33% | 10% | 9%
src/utils0% | 21% | 28% | 23% | 26%
build/extracted-examples0% | 0% | 10% | 39% | 50%
src/search0% | 0% | 75% | 16% | 7%
src/hh-apidoc-extensions0% | 0% | 36% | 15% | 47%
public0% | 0% | 100% | 0% | 0%
public/js0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
167 32 2
165 1 1
111 8 0
104 1 0
101 6 1
84 14 3
84 17 2
83 1 1
76 1 0
75 13 3
72 13 2
68 5 0
67 4 3
63 10 1
63 14 8
61 11 0
60 10 0
60 5 1
59 5 0
58 10 2
54 6 1
54 9 2
53 10 2
51 1 0
51 5 3
50 2 0
50 8 2
46 1 0
44 8 0
44 5 1
44 5 4
44 8 0
43 2 1
43 3 2
42 4 2
42 6 0
42 1 1
41 9 6
40 8 1
40 10 5
39 10 0
38 15 1
38 6 2
38 5 2
37 9 2
37 3 0
37 5 2
36 7 0
35 6 1
35 7 1