facebookresearch / Motionformer
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 499 units with 6,673 lines of code in units (61.0% of code).
    • 3 very long units (383 lines of code)
    • 14 long units (1,022 lines of code)
    • 84 medium size units (2,513 lines of code)
    • 90 small units (1,302 lines of code)
    • 308 very small units (1,453 lines of code)
5% | 15% | 37% | 19% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | 15% | 37% | 19% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
slowfast/datasets7% | 14% | 32% | 20% | 24%
slowfast/models12% | 15% | 31% | 26% | 14%
tools43% | 37% | 7% | 4% | 6%
slowfast/visualization0% | 14% | 40% | 20% | 24%
slowfast/utils0% | 10% | 50% | 16% | 22%
ROOT0% | 48% | 18% | 16% | 16%
slowfast/config0% | 0% | 0% | 78% | 21%
data/kinetics_4000% | 0% | 0% | 0% | 100%
data/kinetics_6000% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __getitem__()
in slowfast/datasets/kinetics.py
149 31 2
def __init__()
in slowfast/models/video_model_builder.py
118 16 2
def train()
in tools/train_net.py
116 34 1
def eval_epoch()
in tools/train_net.py
100 31 6
def __getitem__()
in slowfast/datasets/ssv2.py
95 23 2
def parse_args()
in run_with_submitit.py
89 1 0
def draw_video()
in slowfast/visualization/ava_demo_precomputed_boxes.py
87 21 1
def forward()
in slowfast/models/vit_helper.py
85 6 6
def __getitem__()
in slowfast/datasets/epickitchens.py
76 21 2
def _construct_loader()
in slowfast/datasets/ssv2.py
70 9 1
def benchmark_data_loading()
in slowfast/utils/benchmark.py
68 7 1
def forward_features()
in slowfast/models/video_model_builder.py
62 10 2
def get_long_cycle_schedule()
in slowfast/utils/multigrid.py
61 11 2
def get_name_convert_func()
in slowfast/utils/c2_model_loading.py
60 2 0
def construct_loader()
in slowfast/datasets/loader.py
59 13 3
def plot_eval()
in slowfast/visualization/tensorboard_vis.py
57 9 4
def _calculate_localization_map()
in slowfast/visualization/gradcam_utils.py
53 5 3
def __call__()
in slowfast/visualization/predictor.py
50 16 2
def __init__()
in slowfast/visualization/tensorboard_vis.py
50 8 2
def get_predictions()
in slowfast/visualization/ava_demo_precomputed_boxes.py
48 8 1