facebookresearch / tbsm
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 29 units with 1,075 lines of code in units (79.3% of code).
    • 2 very long units (295 lines of code)
    • 7 long units (478 lines of code)
    • 7 medium size units (193 lines of code)
    • 3 small units (47 lines of code)
    • 10 very small units (62 lines of code)
27% | 44% | 17% | 4% | 5%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py27% | 44% | 17% | 4% | 5%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT32% | 39% | 20% | 3% | 4%
tools0% | 76% | 0% | 12% | 11%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def synthetic_experiment()
in tbsm_synthetic.py
193 29 0
def build_taobao_train_or_val()
in tbsm_data_pytorch.py
102 21 3
def iterate_train_data()
in tbsm_pytorch.py
96 23 11
def get_tbsm()
in tbsm_pytorch.py
78 18 2
def forward()
in tbsm_pytorch.py
68 34 4
def train_tbsm()
in tbsm_pytorch.py
65 18 2
def gen_dataset()
in tools/taobao_prepare.py
60 6 5
def produce_neg_item_hist_with_cate()
in tools/taobao_prepare.py
58 13 2
def build_taobao_test()
in tbsm_data_pytorch.py
53 12 3
def make_tbsm_data_and_loader()
in tbsm_data_pytorch.py
38 3 2
def forward()
in tbsm_pytorch.py
33 8 3
def truncate_and_save()
in tbsm_data_pytorch.py
30 5 9
def test_tbsm()
in tbsm_pytorch.py
27 5 2
def collate_wrapper_tbsm()
in tbsm_data_pytorch.py
22 4 1
def __init__()
in tbsm_pytorch.py
22 1 0
def iterate_val_data()
in tbsm_pytorch.py
21 3 4
def remap()
in tools/taobao_prepare.py
19 2 1
def build_synthetic_train_or_val()
in tbsm_data_pytorch.py
17 2 2
def __init__()
in tbsm_data_pytorch.py
11 2 0
def set_seed()
in tbsm_pytorch.py
10 3 2