facebookresearch / esm
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 122 units with 1,350 lines of code in units (64.5% of code).
    • 0 very long units (0 lines of code)
    • 8 long units (484 lines of code)
    • 10 medium size units (293 lines of code)
    • 12 small units (173 lines of code)
    • 92 very small units (400 lines of code)
0% | 35% | 21% | 12% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 35% | 21% | 12% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
esm0% | 26% | 23% | 14% | 35%
variant-prediction0% | 81% | 0% | 10% | 7%
ROOT0% | 57% | 42% | 0% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in variant-prediction/predict.py
79 11 1
63 26 2
def add_args()
in esm/model.py
61 1 2
def forward()
in esm/model.py
58 19 5
def create_parser()
in variant-prediction/predict.py
57 1 0
def forward()
in esm/model.py
56 14 5
def main()
in extract.py
56 20 1
def __init__()
in esm/model.py
54 3 3
def tokenize()
in esm/data.py
47 19 3
def create_parser()
in extract.py
42 1 0
def __call__()
in esm/data.py
31 7 3
def __call__()
in esm/data.py
31 7 3
def from_file()
in esm/data.py
28 5 2
25 4 2
def add_args()
in esm/model.py
24 1 2
def upgrade_state_dict_named()
in esm/multihead_attention.py
22 7 3
22 2 1
21 5 3
def compute_pppl()
in variant-prediction/predict.py
18 2 5
def __init__()
in esm/model.py
17 2 3