apple / learning-subspaces
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 198 units with 3,808 lines of code in units (66.8% of code).
    • 4 very long units (624 lines of code)
    • 14 long units (972 lines of code)
    • 39 medium size units (1,210 lines of code)
    • 33 small units (472 lines of code)
    • 108 very small units (530 lines of code)
16% | 25% | 31% | 12% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py16% | 25% | 31% | 12% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT54% | 0% | 19% | 16% | 9%
trainers18% | 50% | 25% | 0% | 5%
data0% | 63% | 36% | 0% | 0%
analyze_results/tinyimagenet0% | 71% | 28% | 0% | 0%
analyze_results/cifar0% | 100% | 0% | 0% | 0%
viz0% | 17% | 45% | 17% | 18%
models0% | 0% | 39% | 26% | 33%
experiment_configs/imagenet0% | 0% | 78% | 21% | 0%
experiment_configs/tinyimagenet0% | 0% | 77% | 22% | 0%
experiment_configs/cifar100% | 0% | 76% | 23% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
224 6 0
def main()
in main.py
168 70 0
def test()
in trainers/eval_one_dim_subspaces_multigpu.py
120 9 5
def train()
in trainers/train_one_dim_subspaces.py
112 35 6
def test()
in trainers/linestats_swa.py
100 7 5
def lvh_helper()
in analyze_results/cifar/one_dimensional_subspaces.py
89 4 3
def lvh_helper()
in analyze_results/tinyimagenet/one_dimensional_subspaces.py
89 4 3
def test()
in trainers/ensemble.py
89 15 5
def test()
in trainers/simplex_ensembles.py
83 20 5
def test()
in trainers/eval_one_dim_subspaces.py
67 4 5
def __init__()
in data/imagenet.py
62 6 1
def test()
in trainers/random_average_weights_perweight.py
60 11 5
def test()
in trainers/swa_endpoint_ensembles.py
59 14 5
def train()
in trainers/train_simplexes.py
58 19 6
def test()
in trainers/train_simplexes.py
58 6 5
def test()
in trainers/average_weights.py
54 13 5
def add_data_helper()
in viz/utils.py
53 14 7
def __init__()
in data/cifar.py
51 5 1
def test()
in trainers/swag.py
45 5 5
def main()
in experiment_configs/imagenet/ensembles/eval_ensembles.py
40 5 0