pytorch / 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 2,524 units with 29,612 lines of code in units (53.4% of code).
    • 23 very long units (3,227 lines of code)
    • 43 long units (2,663 lines of code)
    • 283 medium size units (8,550 lines of code)
    • 507 small units (7,221 lines of code)
    • 1,668 very small units (7,951 lines of code)
10% | 8% | 28% | 24% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 8% | 28% | 24% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
torchbenchmark/models/yolov330% | 2% | 33% | 19% | 13%
torchbenchmark/models/dlrm19% | 13% | 35% | 21% | 10%
torchbenchmark/models/demucs23% | 16% | 23% | 15% | 20%
torchbenchmark/util/framework38% | 22% | 12% | 11% | 15%
torchbenchmark/models/moco36% | 0% | 27% | 13% | 23%
torchbenchmark/models/pyhpc_equation_of_state82% | 0% | 0% | 4% | 12%
torchbenchmark/models/pytorch_stargan34% | 0% | 33% | 14% | 17%
torchbenchmark/models/nvidia_deeprecommender21% | 13% | 44% | 9% | 10%
torchbenchmark/models/timm_efficientdet43% | 23% | 10% | 10% | 12%
torchbenchmark/models/Background_Matting13% | 19% | 15% | 25% | 26%
torchbenchmark/models/tacotron20% | 11% | 30% | 26% | 31%
torchbenchmark/models/attention_is_all_you_need_pytorch0% | 17% | 31% | 25% | 24%
torchbenchmark/models/speech_transformer0% | 21% | 22% | 22% | 34%
torchbenchmark/e2e_models/hf_bert0% | 48% | 38% | 11% | 1%
torchbenchmark/models/LearningToPaint0% | 6% | 12% | 48% | 32%
torchbenchmark/models/pytorch_unet0% | 24% | 6% | 43% | 25%
torchbenchmark/models/Super_SloMo0% | 15% | 32% | 18% | 33%
torchbenchmark/models/soft_actor_critic0% | 5% | 12% | 26% | 55%
torchbenchmark/models/tts_angular0% | 16% | 15% | 29% | 39%
components/_impl/workers0% | 15% | 15% | 22% | 46%
ROOT0% | 5% | 38% | 26% | 29%
torchbenchmark/models/pytorch_CycleGAN_and_pix2pix0% | 0% | 27% | 33% | 39%
torchbenchmark/util/torchtext_legacy0% | 0% | 40% | 32% | 27%
scripts0% | 0% | 64% | 22% | 13%
torchbenchmark/models/maml0% | 0% | 80% | 8% | 10%
torchbenchmark/models/BERT_pytorch0% | 0% | 32% | 22% | 45%
torchbenchmark0% | 0% | 44% | 24% | 31%
torchbenchmark/util0% | 0% | 15% | 42% | 42%
torchbenchmark/models/drq0% | 0% | 28% | 28% | 43%
torchbenchmark/models/pyhpc_turbulent_kinetic_energy0% | 0% | 59% | 18% | 22%
torchbenchmark/models/dcgan0% | 0% | 76% | 6% | 16%
torchbenchmark/score0% | 0% | 23% | 26% | 49%
torchbenchmark/models/pyhpc_isoneutral_mixing0% | 0% | 64% | 7% | 28%
torchbenchmark/models/fastNLP_Bert0% | 0% | 40% | 10% | 48%
torchbenchmark/models/maml_omniglot0% | 0% | 80% | 0% | 19%
torchbenchmark/models/vision_maskrcnn0% | 0% | 39% | 28% | 31%
torchbenchmark/models/pytorch_struct0% | 0% | 27% | 40% | 32%
components/_impl/tasks0% | 0% | 59% | 36% | 3%
torchbenchmark/models/opacus_cifar100% | 0% | 45% | 25% | 29%
torchbenchmark/util/backends0% | 0% | 28% | 43% | 28%
torchbenchmark/microbenchmarks/nvfuser0% | 0% | 0% | 73% | 26%
torchbenchmark/models/detectron2_maskrcnn0% | 0% | 0% | 62% | 37%
torchbenchmark/e2e_models/fambench_xlmr0% | 0% | 0% | 45% | 54%
torchbenchmark/models/resnet50_quantized_qat0% | 0% | 0% | 30% | 69%
torchbenchmark/models/mobilenet_v2_quantized_qat0% | 0% | 0% | 32% | 67%
torchbenchmark/models/squeezenet1_10% | 0% | 0% | 0% | 100%
install_utils0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_BigBird0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_Albert0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_Bart0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_Bert0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_T50% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_GPT20% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_DistilBert0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_Reformer0% | 0% | 0% | 0% | 100%
torchbenchmark/models/hf_Longformer0% | 0% | 0% | 0% | 100%
torchbenchmark/models/timm_regnet0% | 0% | 0% | 0% | 100%
torchbenchmark/models/resnet500% | 0% | 0% | 0% | 100%
torchbenchmark/models/timm_vision_transformer0% | 0% | 0% | 0% | 100%
torchbenchmark/models/timm_nfnet0% | 0% | 0% | 0% | 100%
torchbenchmark/models/mobilenet_v3_large0% | 0% | 0% | 0% | 100%
torchbenchmark/models/timm_efficientnet0% | 0% | 0% | 0% | 100%
torchbenchmark/models/densenet1210% | 0% | 0% | 0% | 100%
torchbenchmark/models/shufflenet_v2_x1_00% | 0% | 0% | 0% | 100%
torchbenchmark/models/resnet180% | 0% | 0% | 0% | 100%
torchbenchmark/models/mnasnet1_00% | 0% | 0% | 0% | 100%
torchbenchmark/models/resnext50_32x4d0% | 0% | 0% | 0% | 100%
torchbenchmark/models/vgg160% | 0% | 0% | 0% | 100%
torchbenchmark/models/mobilenet_v20% | 0% | 0% | 0% | 100%
torchbenchmark/models/alexnet0% | 0% | 0% | 0% | 100%
torchbenchmark/models/timm_vovnet0% | 0% | 0% | 0% | 100%
torchbenchmark/models/timm_resnest0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
308 107 1
232 4 2
228 1 3
161 31 0
153 49 13
151 4 1
147 4 0
135 44 11
132 15 6
132 41 3
124 9 1
121 35 1
120 30 1
117 1 17
115 13 2
114 31 3
111 13 1
111 15 0
106 45 1
105 4 6
102 30 2
101 22 5
101 41 3
100 6 1
96 9 9
86 20 0
81 14 6
76 19 8
75 21 8
74 11 0
71 18 1
70 12 14
67 17 5
66 10 0
66 19 13
65 21 4
64 13 11
63 17 4
62 6 0
60 13 6
58 5 7
58 25 7
58 15 0
58 16 2
57 8 6
57 1 10
57 13 0
57 16 3
57 16 3
57 1 2