facebookresearch / GloRe
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 146 units with 1,818 lines of code in units (77.7% of code).
    • 1 very long units (113 lines of code)
    • 5 long units (399 lines of code)
    • 11 medium size units (322 lines of code)
    • 38 small units (550 lines of code)
    • 91 very small units (434 lines of code)
6% | 21% | 17% | 30% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 21% | 17% | 30% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
train23% | 0% | 13% | 32% | 30%
network0% | 54% | 4% | 17% | 23%
ROOT0% | 78% | 0% | 21% | 0%
data0% | 8% | 27% | 35% | 28%
script0% | 0% | 100% | 0% | 0%
dataset/Kinetics/scripts0% | 0% | 40% | 43% | 16%
dataset/HMDB51/scripts0% | 0% | 0% | 100% | 0%
dataset0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def fit()
in train/model.py
113 30 6
def train_model()
in train_model.py
96 20 20
def __init__()
in network/resnet50_3d_gcn_x5.py
92 19 4
def __init__()
in network/resnet101_3d_gcn_x5.py
92 19 4
def init_3d_from_2d_dict()
in network/initializer.py
68 18 3
def get_kinetics()
in data/iterator_factory.py
51 3 11
def getitem_from_raw_video()
in data/video_iterator.py
41 15 2
def _get_video_list()
in data/video_iterator.py
39 13 4
def __init__()
in data/video_iterator.py
35 6 12
def step()
in train/custom_optim.py
32 12 3
def __init__()
in train/model.py
31 3 10
def __init__()
in data/image_transforms.py
27 6 9
def convert_video_wapper()
in dataset/Kinetics/scripts/convert_videos.py
24 7 5
def duplicate_cache_by_video_length()
in script/generate_testing_list.py
24 4 3
def duplicate_cache_by_fixed_times()
in script/generate_testing_list.py
24 4 3
def extract_frames()
in data/video_iterator.py
23 8 3
def xavier()
in network/initializer.py
22 11 1
def update()
in train/lr_scheduler.py
20 5 1
def save_checkpoint()
in train/model.py
20 6 4
def __call__()
in data/image_transforms.py
20 6 4