facebookresearch / LeViT
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 96 units with 1,522 lines of code in units (89.6% of code).
    • 2 very long units (325 lines of code)
    • 2 long units (148 lines of code)
    • 16 medium size units (527 lines of code)
    • 15 small units (203 lines of code)
    • 61 very small units (319 lines of code)
21% | 9% | 34% | 13% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py21% | 9% | 34% | 13% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT21% | 9% | 34% | 13% | 20%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in main.py
195 48 1
130 1 0
def __init__()
in levit.py
74 9 17
def __init__()
in levit_c.py
74 9 17
def __init__()
in levit.py
50 4 10
def __init__()
in levit_c.py
50 4 10
def log_every()
in utils.py
45 7 4
39 8 12
def model_factory()
in levit_c.py
37 8 10
def __init__()
in levit.py
34 4 7
def __init__()
in levit_c.py
34 4 7
def main()
in run_with_submitit.py
32 4 0
32 6 10
def __init__()
in datasets.py
32 4 8
def build_transform()
in datasets.py
27 4 2
def build_dataset()
in datasets.py
26 10 2
def forward()
in losses.py
26 4 4
def evaluate()
in engine.py
21 3 3
21 4 1
def __init__()
in samplers.py
21 5 5