facebookresearch / music-translation
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 141 units with 1,763 lines of code in units (36.0% of code).
    • 1 very long units (111 lines of code)
    • 5 long units (357 lines of code)
    • 17 medium size units (432 lines of code)
    • 35 small units (502 lines of code)
    • 83 very small units (361 lines of code)
6% | 20% | 24% | 28% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 20% | 25% | 25% | 20%
cpp0% | 18% | 21% | 39% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src8% | 15% | 28% | 28% | 19%
src/nv-wavenet0% | 31% | 15% | 29% | 23%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in src/nv_wavenet_generator.py
111 19 6
def build_extensions()
in src/nv-wavenet/setup.py
92 30 1
def main()
in src/run_on_files.py
85 22 1
uint64_t construct()
in src/nv-wavenet/wavenet_infer_wrapper.cpp
72 2 21
def dump_to_folder()
in src/data.py
57 4 3
def __init__()
in src/train.py
51 9 2
void nvWavenetReference::run()
in src/nv-wavenet/nv_wavenet_reference.cpp
35 11 3
def main()
in src/parse_musicnet.py
34 5 0
31 12 2
def main()
in src/data_samples.py
30 7 0
def train_batch()
in src/train.py
29 4 4
void matrix_compare()
in src/nv-wavenet/matrix.cpp
26 9 5
def evaluate_epoch()
in src/train.py
25 6 2
def train_epoch()
in src/train.py
24 6 2
def __init__()
in src/wavenet.py
23 4 4
def forward()
in src/wavenet.py
23 8 3
def __init__()
in src/data.py
23 5 9
def parse_args()
in src/run_on_files.py
22 1 0
void nvWavenetLayer()
in src/nv-wavenet/nv_wavenet_reference.cpp
22 3 17
def train()
in src/train.py
22 5 1