facebookresearch / deepcluster
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 80 units with 1,341 lines of code in units (80.2% of code).
    • 1 very long units (103 lines of code)
    • 3 long units (231 lines of code)
    • 16 medium size units (495 lines of code)
    • 20 small units (309 lines of code)
    • 40 very small units (203 lines of code)
7% | 17% | 36% | 23% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py7% | 17% | 36% | 23% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT9% | 21% | 33% | 19% | 15%
visu0% | 0% | 61% | 31% | 7%
models0% | 0% | 40% | 40% | 18%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in main.py
103 14 1
def main()
in eval_voc_classif.py
95 15 0
def main()
in eval_linear.py
85 10 0
def train()
in main.py
51 8 5
def main()
in visu/activ-retrieval.py
43 16 1
def main()
in visu/gradient_ascent.py
41 8 0
def validate()
in eval_linear.py
38 6 4
37 14 4
def train()
in eval_voc_classif.py
37 13 10
def load()
in eval_retrieval.py
35 18 1
def train()
in eval_linear.py
35 6 6
def cluster()
in clustering.py
29 14 3
def __init__()
in models/vgg16.py
29 3 4
28 9 2
def __init__()
in models/alexnet.py
28 3 4
def __init__()
in eval_retrieval.py
24 1 3
def evaluate()
in eval_voc_classif.py
24 9 3
23 8 3
22 6 1
def rmac()
in eval_retrieval.py
22 5 3