apple / learning-compressible-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 210 units with 2,606 lines of code in units (61.3% of code).
    • 1 very long units (169 lines of code)
    • 8 long units (570 lines of code)
    • 24 medium size units (731 lines of code)
    • 29 small units (424 lines of code)
    • 148 very small units (712 lines of code)
6% | 21% | 28% | 16% | 27%
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% | 28% | 16% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT11% | 20% | 37% | 17% | 12%
models/networks0% | 41% | 13% | 19% | 26%
models0% | 7% | 21% | 11% | 59%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
169 23 1
def get_method_config()
in get_training_params.py
100 23 2
def get_slimmed_network()
in models/networks/resprune.py
90 23 4
def module_profiling()
in models/networks/model_profiling.py
85 13 4
def train_model()
in train_indep.py
66 10 1
def train_model()
in train_curve.py
65 10 1
def lec_update()
in train_indep.py
62 13 3
def forward()
in models/modules.py
51 12 2
def get_slimmed_network()
in models/networks/vggprune.py
51 14 4
44 1 2
def _initialize_weights()
in models/networks/vgg.py
41 14 1
41 1 1
def gen_args()
in args.py
40 1 1
37 3 5
def forward()
in models/modules.py
35 13 2
34 2 0
33 5 2
def forward()
in models/quantize_affine.py
32 9 4
def structured_args_dict()
in get_training_params.py
31 11 2
30 4 0