facebookresearch / moco-v3
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 60 units with 791 lines of code in units (72.9% of code).
    • 2 very long units (265 lines of code)
    • 0 long units (0 lines of code)
    • 8 medium size units (223 lines of code)
    • 7 small units (96 lines of code)
    • 43 very small units (207 lines of code)
33% | 0% | 28% | 12% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py33% | 0% | 28% | 12% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT44% | 0% | 27% | 9% | 18%
transfer0% | 0% | 41% | 28% | 30%
moco0% | 0% | 22% | 12% | 66%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main_worker()
in main_lincls.py
141 43 3
def main_worker()
in main_moco.py
124 26 3
def build_dataset()
in transfer/datasets.py
37 8 2
def train()
in main_moco.py
35 8 7
def train()
in main_lincls.py
31 7 6
def validate()
in main_lincls.py
30 6 4
def main()
in main_moco.py
23 7 0
def main()
in main_lincls.py
23 7 0
def __init__()
in vits.py
22 3 7
def step()
in moco/optimizer.py
22 8 1
def __init__()
in vits.py
19 6 3
16 1 2
def build_transform()
in transfer/datasets.py
14 2 2
def _build_mlp()
in moco/builder.py
12 7 6
def sanity_check()
in main_lincls.py
12 5 3
def accuracy()
in main_lincls.py
12 2 3
def __getitem__()
in transfer/oxford_pets_dataset.py
11 3 2
def __getitem__()
in transfer/oxford_flowers_dataset.py
9 3 2
def forward()
in vits.py
9 3 2
def __init__()
in moco/builder.py
9 2 5