facebookresearch / synsin
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 225 units with 3,974 lines of code in units (78.1% of code).
    • 3 very long units (517 lines of code)
    • 12 long units (833 lines of code)
    • 48 medium size units (1,420 lines of code)
    • 42 small units (603 lines of code)
    • 120 very small units (601 lines of code)
13% | 20% | 35% | 15% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py13% | 20% | 35% | 15% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
models/networks20% | 0% | 41% | 20% | 17%
options29% | 49% | 12% | 5% | 2%
data16% | 50% | 20% | 4% | 7%
models0% | 46% | 48% | 0% | 4%
ROOT0% | 35% | 43% | 16% | 5%
models/layers0% | 0% | 57% | 4% | 37%
evaluation0% | 0% | 52% | 25% | 21%
models/losses0% | 0% | 24% | 40% | 35%
models/projection0% | 0% | 52% | 27% | 20%
utils0% | 0% | 0% | 100% | 0%
geometry0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_resnet_arch()
in models/networks/configs.py
276 7 3
def add_model_parameters()
in options/train_options.py
126 1 1
def __init__()
in data/create_rgb_dataset.py
115 14 6
def add_train_parameters()
in options/train_options.py
98 1 1
def get_singleenv_sample()
in data/create_rgb_dataset.py
84 11 2
def get_vector_sample()
in data/create_rgb_dataset.py
82 11 4
def run()
in train.py
75 10 5
def __init__()
in models/encoderdecoder.py
70 1 2
def __init__()
in models/encoderdecoder.py
70 1 2
def __getitem__()
in data/realestate10k.py
70 6 2
def forward()
in models/z_buffermodel.py
65 11 2
def get_dataset()
in options/options.py
62 6 1
def __getitem__()
in data/realestate10k.py
55 2 2
def add_data_parameters()
in options/train_options.py
51 1 1
def __getitem_simple__()
in data/realestate10k.py
51 2 2
def train()
in train.py
49 14 6
def compute_perceptual_similarity()
in evaluation/evaluate_perceptualsim.py
49 6 4
def forward()
in models/layers/z_buffer_layers.py
48 7 3
def project_zbuffer()
in models/projection/depth_manipulator.py
48 2 6
def val()
in train.py
42 12 5