facebookresearch / RidgeSketch
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 218 units with 2,840 lines of code in units (56.1% of code).
    • 1 very long units (102 lines of code)
    • 5 long units (306 lines of code)
    • 30 medium size units (1,026 lines of code)
    • 48 small units (714 lines of code)
    • 134 very small units (692 lines of code)
3% | 10% | 36% | 25% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 10% | 36% | 25% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
experiments7% | 11% | 42% | 20% | 17%
benchmarks0% | 19% | 37% | 22% | 20%
ROOT0% | 7% | 32% | 31% | 28%
datasets0% | 0% | 0% | 35% | 64%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def bar_plot_times_momentum()
in experiments/plot_experiments.py
102 1 1
def run()
in benchmarks/run_benchmarks.py
75 20 3
61 22 5
def plot_residual_v_iteration()
in experiments/plot_experiments.py
60 3 4
def filter_sketch_sizes()
in experiments/momentum_regimes.py
55 13 2
def filter_sketch_sizes()
in experiments/regularization_on_momentum.py
55 13 2
50 12 5
def get_config_combinations()
in benchmarks/run_benchmarks.py
49 8 1
def __init__()
in benchmarks/run_benchmarks.py
46 11 3
def run_full_exp()
in experiments/different_sketches.py
45 4 2
def run_full_exp()
in experiments/compare_conjugate_gradient.py
45 4 2
def save_plots()
in experiments/different_sketch_sizes_time_bar_plots.py
40 6 3
def fit()
in ridge_sketch.py
38 11 3
def conjugate_grad()
in conjugate_gradients.py
37 6 5
def run_no_momentum()
in experiments/momentum_regimes.py
37 3 1
def run_constant_momentum()
in experiments/momentum_regimes.py
37 3 1
def run_increasing_momentum()
in experiments/momentum_regimes.py
37 3 1
def run_no_momentum()
in experiments/different_sketch_sizes_time_bar_plots.py
37 3 1
def run_constant_momentum()
in experiments/different_sketch_sizes_time_bar_plots.py
37 3 1
def run_increasing_momentum()
in experiments/different_sketch_sizes_time_bar_plots.py
37 3 1