facebookresearch / label_dp_antipodes
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 140 units with 1,555 lines of code in units (65.6% of code).
    • 1 very long units (145 lines of code)
    • 3 long units (207 lines of code)
    • 13 medium size units (328 lines of code)
    • 22 small units (320 lines of code)
    • 101 very small units (555 lines of code)
9% | 13% | 21% | 20% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py9% | 13% | 21% | 20% | 35%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT37% | 21% | 18% | 14% | 8%
lib/pate0% | 20% | 9% | 24% | 45%
memorization_attack0% | 61% | 0% | 19% | 18%
lib/models0% | 0% | 37% | 8% | 54%
lib0% | 0% | 27% | 34% | 38%
lib/dataset0% | 0% | 26% | 20% | 52%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main_worker()
in train_cifar_alibi.py
145 20 1
def main()
in train_cifar_alibi.py
83 1 0
def run_analysis()
in lib/pate/accountant.py
71 7 4
def compute_eps()
in memorization_attack/attack.py
53 13 3
def __init__()
in lib/models/wide_resnet.py
35 6 5
def rdp_gaussian()
in lib/pate/accountant.py
34 14 3
def main()
in aggregate_votes.py
30 4 1
28 2 2
def test()
in lib/fixmatch.py
24 2 3
def __init__()
in lib/models/resnet.py
24 3 4
def get_cifar10()
in lib/dataset/cifar.py
23 1 3
def get_cifar100()
in lib/dataset/cifar.py
23 1 3
def __init__()
in lib/models/resnet.py
22 3 4
def get_eps()
in train_student.py
22 6 2
def test()
in train_cifar_alibi.py
21 2 5
def __init__()
in lib/dataset/cifar.py
21 1 3
def post_process()
in lib/alibi.py
21 9 3
def my_augment_pool()
in lib/dataset/randaugment.py
20 1 0
def train()
in train_cifar_alibi.py
19 5 5
def update()
in lib/models/ema.py
19 6 2