facebookresearch / SlowFast
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 649 units with 9,566 lines of code in units (53.7% of code).
    • 10 very long units (1,376 lines of code)
    • 21 long units (1,445 lines of code)
    • 93 medium size units (2,838 lines of code)
    • 132 small units (1,913 lines of code)
    • 393 very small units (1,994 lines of code)
14% | 15% | 29% | 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
py14% | 15% | 29% | 19% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
slowfast/models27% | 14% | 21% | 20% | 14%
slowfast/datasets16% | 14% | 31% | 18% | 18%
tools44% | 35% | 10% | 7% | 2%
slowfast/utils0% | 12% | 34% | 23% | 29%
slowfast/visualization0% | 14% | 38% | 20% | 26%
slowfast/config0% | 0% | 0% | 80% | 20%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _construct_network()
in slowfast/models/video_model_builder.py
200 5 2
def __init__()
in slowfast/models/video_model_builder.py
162 38 2
def __getitem__()
in slowfast/datasets/kinetics.py
149 25 2
def _construct_network()
in slowfast/models/ptv_model_builder.py
138 5 2
def run_visualization()
in tools/visualization.py
136 40 4
def _construct_network()
in slowfast/models/video_model_builder.py
135 9 2
def train()
in tools/train_net.py
122 31 1
def Ptvssv2()
in slowfast/datasets/ptv_datasets.py
118 9 2
def Ptvcharades()
in slowfast/datasets/ptv_datasets.py
114 7 2
def Ptvkinetics()
in slowfast/datasets/ptv_datasets.py
102 7 2
def _construct_network()
in slowfast/models/ptv_model_builder.py
98 6 2
def _images_and_boxes_preprocessing_cv2()
in slowfast/datasets/ava_dataset.py
90 22 3
def draw_video()
in slowfast/visualization/ava_demo_precomputed_boxes.py
87 21 1
def forward()
in slowfast/models/attention.py
87 10 3
def eval_epoch()
in tools/train_net.py
80 27 6
def construct_optimizer()
in slowfast/models/optimizer.py
79 19 2
def visualize()
in tools/visualization.py
72 19 1
def _construct_loader()
in slowfast/datasets/ssv2.py
70 9 1
def _images_and_boxes_preprocessing()
in slowfast/datasets/ava_dataset.py
68 14 3
def benchmark_data_loading()
in slowfast/utils/benchmark.py
68 7 1