facebookresearch / PyTorch-BigGraph
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 568 units with 3,932 lines of code in units (48.9% of code).
    • 3 very long units (426 lines of code)
    • 6 long units (406 lines of code)
    • 23 medium size units (620 lines of code)
    • 41 small units (599 lines of code)
    • 495 very small units (1,881 lines of code)
10% | 10% | 15% | 15% | 47%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 6% | 16% | 16% | 50%
cpp0% | 88% | 11% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
torchbiggraph11% | 7% | 16% | 14% | 49%
torchbiggraph/converters0% | 35% | 6% | 25% | 32%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _coordinate_train()
in torchbiggraph/train_gpu.py
180 33 4
def train()
in torchbiggraph/train_cpu.py
142 18 1
def forward()
in torchbiggraph/model.py
104 18 2
void shuffle()
in torchbiggraph/util.cpp
90 19 3
torch::Tensor randperm()
in torchbiggraph/util.cpp
84 15 3
def make_model()
in torchbiggraph/model.py
63 9 1
def main()
in torchbiggraph/converters/import_from_parquet.py
59 1 0
def main()
in torchbiggraph/converters/import_from_tsv.py
59 1 0
def start()
in torchbiggraph/parameter_sharing.py
51 12 2
def step()
in torchbiggraph/async_adagrad.py
45 10 2
def run()
in torchbiggraph/train_gpu.py
38 5 1
def step()
in torchbiggraph/row_adagrad.py
38 9 2
def handle_get()
in torchbiggraph/parameter_sharing.py
38 7 4
def _coordinate_train()
in torchbiggraph/train_cpu.py
31 6 4
def __init__()
in torchbiggraph/filtered_eval.py
29 9 3
def help()
in torchbiggraph/schema.py
28 10 1
def __init__()
in torchbiggraph/util.py
27 3 2
def __attrs_post_init__()
in torchbiggraph/config.py
26 11 1
def __getitem__()
in torchbiggraph/edgelist.py
26 6 4
def _coordinate_eval()
in torchbiggraph/train_cpu.py
26 3 3