facebookresearch / vocoder-benchmark
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 320 units with 2,854 lines of code in units (46.5% of code).
    • 0 very long units (0 lines of code)
    • 6 long units (387 lines of code)
    • 26 medium size units (753 lines of code)
    • 45 small units (674 lines of code)
    • 243 very small units (1,040 lines of code)
0% | 13% | 26% | 23% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 13% | 26% | 23% | 36%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
models0% | 26% | 31% | 14% | 27%
models/src/wavegrad0% | 19% | 27% | 26% | 25%
ROOT0% | 33% | 21% | 16% | 28%
models/src/parallel_wavegan/optimizers0% | 90% | 0% | 0% | 9%
models/src/wavenet_vocoder0% | 0% | 33% | 15% | 50%
models/src/ptflops0% | 0% | 27% | 35% | 37%
models/src/wavenet_vocoder/tfcompat0% | 0% | 39% | 30% | 30%
models/src/parallel_wavegan/layers0% | 0% | 21% | 29% | 49%
models/src/parallel_wavegan/models0% | 0% | 8% | 46% | 45%
models/src/diffwave0% | 0% | 20% | 25% | 54%
models/src/parallel_wavegan/losses0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in models/parallel_wavegan.py
83 5 2
def __init__()
in models/src/wavegrad/nn.py
78 5 2
def split_command()
in datasets.py
65 7 2
def step()
in models/src/parallel_wavegan/optimizers/radam.py
58 9 2
def generate()
in models/diffwave.py
52 8 3
def generate()
in models/wavenet.py
51 11 3
def __init__()
in models/wavenet.py
46 4 2
def create_model_commands()
in models/framework.py
44 2 1
def __init__()
in models/src/wavegrad/upsampling.py
44 2 5
def __init__()
in models/src/wavegrad/downsampling.py
38 4 5
def generate()
in models/wavernn.py
37 5 3
def parse_values()
in models/src/wavenet_vocoder/tfcompat/hparam.py
36 3 2
def __init__()
in models/src/parallel_wavegan/layers/pqmf.py
36 4 5
def mix_gaussian_loss()
in models/src/wavenet_vocoder/mixture.py
35 9 4
def start_flops_count()
in models/src/ptflops/flops_counter.py
33 9 2
def multihead_attention_counter_hook()
in models/src/ptflops/flops_counter.py
30 4 3
def sample_from_mix_gaussian()
in models/src/wavenet_vocoder/mixture.py
29 7 2
def __init__()
in models/src/wavegrad/linear_modulation.py
29 1 4
def _forward()
in models/src/wavenet_vocoder/modules.py
26 5 5
def loss()
in models/wavenet.py
25 5 3