facebookresearch / deit
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 123 units with 1,651 lines of code in units (90.7% of code).
    • 2 very long units (328 lines of code)
    • 1 long units (52 lines of code)
    • 8 medium size units (255 lines of code)
    • 45 small units (657 lines of code)
    • 67 very small units (359 lines of code)
19% | 3% | 15% | 39% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py19% | 3% | 15% | 39% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT19% | 3% | 15% | 39% | 21%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in main.py
211 52 1
117 1 0
def __init__()
in patchconvnet_models.py
52 11 28
def log_every()
in utils.py
45 7 4
def __init__()
in cait_models.py
41 5 27
34 7 11
def main()
in run_with_submitit.py
31 4 0
def __init__()
in datasets.py
31 4 8
def build_transform()
in datasets.py
27 4 2
def forward()
in losses.py
25 7 4
21 4 1
def evaluate()
in engine.py
20 3 3
def __init__()
in samplers.py
20 6 6
def __init__()
in resmlp_models.py
20 4 12
def resmlp_24()
in resmlp_models.py
19 4 4
def resmlpB_24()
in resmlp_models.py
19 4 4
def build_dataset()
in datasets.py
18 6 2
def __init__()
in patchconvnet_models.py
17 1 5
def cait_XXS24_224()
in cait_models.py
17 3 2
def cait_XXS24()
in cait_models.py
17 3 2