facebookresearch / GAN-optimization-landscape
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 83 units with 1,363 lines of code in units (73.6% of code).
    • 2 very long units (272 lines of code)
    • 2 long units (137 lines of code)
    • 10 medium size units (317 lines of code)
    • 30 small units (451 lines of code)
    • 39 very small units (186 lines of code)
19% | 10% | 23% | 33% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py19% | 10% | 23% | 33% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT36% | 18% | 26% | 7% | 11%
lib/optim0% | 0% | 48% | 34% | 16%
lib/models0% | 0% | 7% | 85% | 7%
lib0% | 0% | 0% | 57% | 42%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in train_mnist.py
157 44 1
def compute_path_stats()
in plot_path_tools.py
115 34 15
def plot_path_stats()
in plot_path_tools.py
78 10 4
def compute_eigenvalues()
in plot_path_tools.py
59 13 10
def train_mnist_classifier()
in gan_eval_metrics.py
45 8 3
def step()
in lib/optim/omd.py
42 14 2
def visualize_interpolation()
in plot_path_tools.py
39 10 12
def update()
in lib/optim/extragradient.py
32 10 3
def __init__()
in train_mnist.py
31 1 1
def mnist_inception_score()
in gan_eval_metrics.py
31 6 5
def __init__()
in train_mnist.py
27 2 6
def plot_eigenvalues()
in plot_path_tools.py
24 8 7
def update()
in lib/optim/extragradient.py
23 6 3
def __init__()
in lib/models/wgangp.py
23 6 5
def __init__()
in lib/models/conv.py
19 3 6
def forward()
in lib/models/conv.py
19 5 2
def __init__()
in lib/models/conv.py
19 3 6
def forward()
in lib/models/conv.py
19 5 2
def __init__()
in lib/models/conv.py
18 3 6
def __init__()
in lib/models/mlp.py
17 6 9