facebookresearch / TimeSformer
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 473 units with 6,564 lines of code in units (65.7% of code).
    • 4 very long units (595 lines of code)
    • 13 long units (899 lines of code)
    • 65 medium size units (2,036 lines of code)
    • 105 small units (1,527 lines of code)
    • 286 very small units (1,507 lines of code)
9% | 13% | 31% | 23% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py9% | 13% | 31% | 23% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
timesformer/models16% | 7% | 29% | 24% | 22%
tools21% | 47% | 15% | 9% | 5%
timesformer/datasets10% | 12% | 33% | 22% | 21%
timesformer/utils0% | 10% | 34% | 26% | 27%
timesformer/visualization0% | 17% | 34% | 14% | 34%
timesformer/config0% | 0% | 0% | 88% | 11%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _construct_network()
in timesformer/models/video_model_builder.py
202 5 2
def run_visualization()
in tools/visualization.py
136 40 4
def _construct_network()
in timesformer/models/video_model_builder.py
130 5 2
def __getitem__()
in timesformer/datasets/kinetics.py
127 23 2
def train()
in tools/train_net.py
90 28 1
def load_pretrained()
in timesformer/models/helpers.py
86 27 11
def eval_epoch()
in tools/train_net.py
80 27 6
def __getitem__()
in timesformer/datasets/ssv2.py
79 18 2
def visualize()
in tools/visualization.py
74 19 1
def _construct_loader()
in timesformer/datasets/ssv2.py
70 9 1
def benchmark_data_loading()
in timesformer/utils/benchmark.py
68 7 1
def _construct_network()
in timesformer/models/video_model_builder.py
67 4 2
def get_long_cycle_schedule()
in timesformer/utils/multigrid.py
61 11 2
def get_name_convert_func()
in timesformer/utils/c2_model_loading.py
60 2 0
def plot_eval()
in timesformer/visualization/tensorboard_vis.py
57 9 4
def evaluate()
in timesformer/utils/ava_evaluation/object_detection_evaluation.py
56 8 1
def parse_args()
in tools/submit.py
51 1 0
def __init__()
in timesformer/visualization/tensorboard_vis.py
50 8 2
def get_class_names()
in timesformer/utils/misc.py
47 14 3
def add_single_ground_truth_image_info()
in timesformer/utils/ava_evaluation/object_detection_evaluation.py
47 11 3