facebookresearch / adaptive-span
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 70 units with 942 lines of code in units (76.8% of code).
    • 1 very long units (101 lines of code)
    • 0 long units (0 lines of code)
    • 13 medium size units (367 lines of code)
    • 17 small units (251 lines of code)
    • 39 very small units (223 lines of code)
10% | 0% | 38% | 26% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 0% | 38% | 26% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT10% | 0% | 38% | 26% | 23%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def launch()
in main.py
101 16 8
def step()
in adagrad_with_grad_clip.py
41 10 2
def forward()
in adaptive_io.py
38 11 3
def _train_batch()
in trainer.py
33 11 8
33 7 10
def log_iter()
in utils.py
32 4 7
def full_eval()
in trainer.py
30 5 6
def forward()
in models.py
25 6 4
25 4 5
23 1 3
def __init__()
in adaptive_io.py
22 2 6
def __init__()
in models.py
22 4 9
def forward()
in persistent_memory.py
22 2 3
def forward()
in models.py
21 5 5
def __init__()
in data.py
20 8 3
def __init__()
in adaptive_io.py
19 2 6
def forward()
in adaptive_io.py
18 7 2
18 2 5
def forward()
in models.py
17 1 5
def __init__()
in models.py
16 4 8