facebookresearch / SLIP
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 220 units with 2,874 lines of code in units (88.0% of code).
    • 3 very long units (576 lines of code)
    • 4 long units (244 lines of code)
    • 27 medium size units (894 lines of code)
    • 26 small units (358 lines of code)
    • 160 very small units (802 lines of code)
20% | 8% | 31% | 12% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py20% | 8% | 31% | 12% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
beit_finetuning25% | 6% | 35% | 9% | 23%
ROOT16% | 10% | 27% | 14% | 30%
redcaps0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in beit_finetuning/run_class_finetuning.py
314 81 2
def main()
in main.py
132 32 1
def main()
in main_linear.py
130 28 1
def create_optimizer()
in beit_finetuning/optim_factory.py
76 37 6
def main()
in eval_zeroshot.py
62 9 1
def train()
in main.py
54 16 8
52 1 0
def auto_load_model()
in beit_finetuning/utils.py
47 20 6
def log_every()
in beit_finetuning/utils.py
45 7 4
def get_args_parser()
in main_linear.py
45 1 0
45 6 4
def load_state_dict()
in beit_finetuning/utils.py
41 13 4
def get_args_parser()
in beit_finetuning/run_class_finetuning.py
40 1 0
def __init__()
in beit_finetuning/modeling_finetune.py
40 11 21
def validate_zeroshot()
in eval_zeroshot.py
40 10 6
def __init__()
in beit_finetuning/modeling_finetune.py
39 5 9
def bpe()
in tokenizer.py
37 10 2
def get_parameter_groups()
in beit_finetuning/optim_factory.py
36 9 3
def init_distributed_mode()
in beit_finetuning/utils.py
32 5 1
def train()
in main_linear.py
32 7 6