facebookresearch / ic_gan
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 580 units with 10,444 lines of code in units (51.6% of code).
    • 14 very long units (3,125 lines of code)
    • 22 long units (1,523 lines of code)
    • 72 medium size units (2,141 lines of code)
    • 138 small units (1,971 lines of code)
    • 334 very small units (1,684 lines of code)
29% | 14% | 20% | 18% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py30% | 14% | 20% | 18% | 16%
cpp0% | 51% | 37% | 10% | 0%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
BigGAN_PyTorch45% | 8% | 18% | 14% | 13%
data_utils32% | 18% | 19% | 17% | 11%
stylegan2_ada_pytorch32% | 24% | 22% | 7% | 13%
stylegan2_ada_pytorch/training31% | 4% | 19% | 26% | 18%
inference52% | 30% | 7% | 5% | 4%
ROOT57% | 0% | 0% | 20% | 21%
BigGAN_PyTorch/TFHub17% | 0% | 38% | 32% | 11%
stylegan2_ada_pytorch/torch_utils0% | 31% | 21% | 27% | 19%
stylegan2_ada_pytorch/metrics0% | 12% | 30% | 30% | 26%
BigGAN_PyTorch/sync_batchnorm0% | 0% | 28% | 18% | 52%
stylegan2_ada_pytorch/dnnlib0% | 0% | 15% | 29% | 55%
BigGAN_PyTorch/logs0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def prepare_parser()
in BigGAN_PyTorch/utils.py
800 4 0
def train()
in BigGAN_PyTorch/trainer.py
382 20 4
def forward()
in stylegan2_ada_pytorch/training/augment.py
345 51 3
def get_parser()
in stylegan2_ada_pytorch/parser.py
227 2 0
def __call__()
in inference/test.py
202 39 1
def run()
in data_utils/inception_tf13.py
195 42 1
def run()
in data_utils/make_hdf5.py
171 34 1
def predict()
in predict.py
122 24 6
def train()
in BigGAN_PyTorch/train_fns.py
121 25 3
def convert_tf_generator()
in stylegan2_ada_pytorch/legacy.py
118 8 1
def convert_from_v1()
in BigGAN_PyTorch/TFHub/converter.py
115 6 2
def load_model_inference()
in inference/utils.py
112 17 2
def run()
in data_utils/calculate_inception_moments.py
110 23 1
def prepare_parser()
in data_utils/make_hdf5.py
105 1 0
def main()
in inference/generate_images.py
97 14 1
def _upfirdn2d_cuda()
in stylegan2_ada_pytorch/torch_utils/ops/upfirdn2d.py
88 7 5
def _bias_act_cuda()
in stylegan2_ada_pytorch/torch_utils/ops/bias_act.py
87 37 5
def convert_tf_discriminator()
in stylegan2_ada_pytorch/legacy.py
87 7 1
def __call__()
in inference/sample.py
84 18 1
def prepare_parser()
in data_utils/calculate_inception_moments.py
74 1 0