facebookresearch / dino
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 146 units with 2,038 lines of code in units (74.8% of code).
    • 2 very long units (237 lines of code)
    • 4 long units (233 lines of code)
    • 23 medium size units (703 lines of code)
    • 21 small units (307 lines of code)
    • 96 very small units (558 lines of code)
11% | 11% | 34% | 15% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 11% | 34% | 15% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT11% | 11% | 34% | 15% | 27%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train_dino()
in main_dino.py
135 27 1
def eval_linear()
in eval_linear.py
102 16 1
def _inference()
in video_generation.py
73 5 3
55 10 1
def log_every()
in utils.py
53 7 4
def __load_model()
in video_generation.py
52 17 1
def train_one_epoch()
in main_dino.py
48 14 12
41 9 3
def extract_features()
in eval_copy_detection.py
40 10 3
def run()
in video_generation.py
40 6 1
37 20 5
36 8 4
def knn_classifier()
in eval_knn.py
34 5 7
def validate_network()
in eval_linear.py
34 9 5
def __init__()
in main_dino.py
33 2 4
def display_instances()
in visualize_attention.py
33 7 5
def main()
in run_with_submitit.py
32 4 0
def parse_args()
in video_generation.py
29 2 0
def train()
in eval_linear.py
28 6 7
27 6 1