facebookresearch / fair_self_supervision_benchmark
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 263 units with 5,329 lines of code in units (64.3% of code).
    • 9 very long units (1,954 lines of code)
    • 8 long units (510 lines of code)
    • 39 medium size units (1,177 lines of code)
    • 59 small units (887 lines of code)
    • 148 very small units (801 lines of code)
36% | 9% | 22% | 16% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py36% | 9% | 22% | 16% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
self_supervision_benchmark/modeling78% | 13% | 2% | 2% | 2%
tools43% | 28% | 20% | 8% | 0%
extra_scripts0% | 5% | 54% | 27% | 11%
tools/svm0% | 17% | 38% | 32% | 11%
self_supervision_benchmark/utils0% | 0% | 40% | 23% | 36%
self_supervision_benchmark/data0% | 0% | 30% | 31% | 38%
self_supervision_benchmark/metrics0% | 0% | 15% | 26% | 57%
self_supervision_benchmark/core0% | 0% | 0% | 75% | 24%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def create_model()
in self_supervision_benchmark/modeling/jigsaw/alexnet_jigsaw_finetune_linear.py
316 38 4
def create_model()
in self_supervision_benchmark/modeling/jigsaw/resnet_jigsaw_finetune_linear.py
278 30 4
def create_model()
in self_supervision_benchmark/modeling/colorization/resnet_colorize_finetune_linear.py
269 31 4
def create_model()
in self_supervision_benchmark/modeling/supervised/resnet_supervised_finetune_linear.py
265 30 4
def create_model()
in self_supervision_benchmark/modeling/colorization/alexnet_colorize_finetune_linear.py
257 32 4
def create_model()
in self_supervision_benchmark/modeling/supervised/caffenet_bvlc_supervised_finetune_linear.py
211 22 4
def create_model()
in self_supervision_benchmark/modeling/jigsaw/alexnet_jigsaw_finetune_full.py
131 8 4
def create_model()
in self_supervision_benchmark/modeling/colorization/alexnet_colorize_finetune_full.py
126 16 4
def train_net()
in tools/train_net.py
101 15 1
def create_model()
in self_supervision_benchmark/modeling/supervised/caffenet_bvlc_supervised_finetune_full.py
76 7 4
def create_model()
in self_supervision_benchmark/modeling/jigsaw/resnet_jigsaw_finetune_full.py
72 6 4
def create_model()
in self_supervision_benchmark/modeling/colorization/resnet_colorize_finetune_full.py
68 6 4
def extract_features()
in tools/extract_features.py
67 13 1
def add_parameter_update_ops()
in self_supervision_benchmark/modeling/model_builder.py
60 12 1
def main()
in extra_scripts/generate_jigsaw_permutations.py
59 12 0
def train_svm()
in tools/svm/train_svm_kfold.py
54 10 1
def create_model()
in self_supervision_benchmark/modeling/supervised/resnet_supervised_finetune_full.py
54 4 4
def train_svm_low_shot()
in tools/svm/train_svm_low_shot.py
48 7 1
def aggregate_stats()
in tools/svm/aggregate_low_shot_svm_stats.py
47 8 1
def get_flops_params()
in self_supervision_benchmark/utils/helpers.py
46 11 2