facebookresearch / gtn_applications
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 139 units with 1,952 lines of code in units (70.4% of code).
    • 1 very long units (194 lines of code)
    • 1 long units (60 lines of code)
    • 25 medium size units (758 lines of code)
    • 36 small units (539 lines of code)
    • 76 very small units (401 lines of code)
9% | 3% | 38% | 27% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py9% | 3% | 38% | 27% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT15% | 4% | 36% | 25% | 18%
scripts0% | 0% | 53% | 30% | 16%
datasets0% | 0% | 25% | 42% | 32%
benchmarks0% | 0% | 82% | 0% | 17%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in train.py
194 20 2
def test()
in test.py
60 7 1
def parse_args()
in train.py
47 7 0
def __init__()
in datasets/iamdb.py
41 9 5
def forward()
in utils.py
41 7 5
def backward()
in utils.py
41 9 2
def read_counts_from_arpa()
in scripts/load_arpa.py
38 13 1
def build_graph()
in scripts/build_transitions.py
36 14 2
def backward()
in transducer.py
34 5 2
def backward()
in transducer.py
32 5 2
def add_blank_grams()
in scripts/build_transitions.py
32 20 3
def word_decompositions()
in benchmarks/transducer_benchmark.py
30 11 0
29 6 3
29 1 0
def __init__()
in models.py
28 1 5
def __init__()
in models.py
28 1 5
def ngram_ctc()
in benchmarks/transducer_benchmark.py
28 6 0
def make_token_graph()
in transducer.py
27 17 3
def __init__()
in models.py
27 3 6
def forward()
in utils.py
26 7 5