facebookresearch / AVT
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 293 units with 4,121 lines of code in units (75.3% of code).
    • 1 very long units (261 lines of code)
    • 15 long units (1,002 lines of code)
    • 38 medium size units (1,172 lines of code)
    • 56 small units (824 lines of code)
    • 183 very small units (862 lines of code)
6% | 24% | 28% | 19% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 24% | 28% | 19% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
func37% | 18% | 14% | 25% | 3%
datasets0% | 27% | 45% | 10% | 15%
models0% | 34% | 23% | 23% | 19%
notebooks0% | 27% | 46% | 14% | 11%
ROOT0% | 49% | 10% | 22% | 16%
common0% | 7% | 6% | 32% | 54%
loss_fn0% | 0% | 36% | 10% | 52%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in func/train.py
261 43 1
def __init__()
in datasets/base_video_dataset.py
97 17 4
def forward()
in models/future_prediction.py
89 13 3
def _sample()
in datasets/base_video_dataset.py
81 21 11
def evaluate()
in func/train.py
76 12 8
def plot_per_cls_perf()
in notebooks/utils.py
72 13 10
def __init__()
in models/base_model.py
69 11 7
69 22 6
def __getitem__()
in datasets/base_video_dataset.py
65 8 2
62 22 1
def forward_singlecrop()
in models/base_model.py
58 2 3
def parse_args()
in launch.py
54 2 0
54 14 6
def __call__()
in func/train_eval_ops.py
54 3 7
def dense_clip_sampler()
in datasets/base_video_dataset.py
51 8 8
def log_every()
in common/log.py
51 6 4
def __init__()
in models/future_prediction.py
50 12 16
def epic100_unseen_tail_eval()
in notebooks/utils.py
50 2 2
def compute_accuracies_epic()
in notebooks/utils.py
47 5 2
def forward()
in loss_fn/simclr_infonce.py
45 7 3