awslabs / deeplearning-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 616 units with 9,355 lines of code in units (78.4% of code).
    • 5 very long units (827 lines of code)
    • 21 long units (1,338 lines of code)
    • 116 medium size units (3,572 lines of code)
    • 137 small units (1,949 lines of code)
    • 337 very small units (1,669 lines of code)
8% | 14% | 38% | 20% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py9% | 15% | 36% | 20% | 17%
scala0% | 0% | 59% | 21% | 19%
java0% | 0% | 42% | 31% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tensorflow15% | 20% | 31% | 14% | 17%
tensorflow_benchmark11% | 9% | 35% | 22% | 20%
image_classification6% | 17% | 41% | 22% | 11%
word_language_model0% | 33% | 16% | 31% | 17%
djl0% | 54% | 0% | 14% | 30%
reporting0% | 27% | 42% | 20% | 9%
scala-mxnet0% | 0% | 56% | 20% | 23%
benchmark0% | 0% | 79% | 0% | 20%
utils0% | 0% | 47% | 27% | 25%
end_to_end_model_benchmark0% | 0% | 47% | 42% | 10%
dawnbench0% | 0% | 55% | 22% | 21%
onnx_benchmark0% | 0% | 100% | 0% | 0%
ssd0% | 0% | 23% | 58% | 19%
ROOT0% | 0% | 52% | 47% | 0%
dependency_update0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def inception_v3()
in tensorflow/inception/inception/slim/inception_model.py
229 6 6
def _benchmark_cnn()
in tensorflow_benchmark/tf_cnn_benchmarks/benchmark_cnn.py
165 53 1
def __init__()
in tensorflow_benchmark/tf_cnn_benchmarks/benchmark_cnn.py
162 62 2
def train()
in tensorflow/inception/inception/inception_distributed_train.py
145 39 3
def fit()
in image_classification/common/fit.py
126 40 4
def train()
in tensorflow/inception/inception/inception_train.py
94 27 1
def get_graph()
in tensorflow/alexnet/alexnet.py
86 6 0
def conv()
in tensorflow_benchmark/tf_cnn_benchmarks/convnet_builder.py
83 17 13
def train_image()
in tensorflow_benchmark/tf_cnn_benchmarks/preprocessing.py
70 11 11
def add_inference()
in tensorflow_benchmark/tf_cnn_benchmarks/models/inception_model.py
66 3 2
def main()
in tensorflow/resnet/resnet_dist.py
66 11 1
def minibatch()
in tensorflow_benchmark/tf_cnn_benchmarks/preprocessing.py
64 12 6
def get_symbol()
in image_classification/symbols/inception-v3.py
63 4 3
def arg_parser()
in image_classification/infer_imagenet_gpu.py
63 1 0
def main()
in tensorflow/alexnet/alexnet.py
63 11 1
def build_input()
in tensorflow/resnet/cifar_input.py
62 5 4
def train()
in djl/trainCiFar10.py
60 12 2
def batch_norm()
in tensorflow/inception/inception/slim/ops.py
59 9 12
def get_rec_iter()
in image_classification/common/data.py
58 7 2
def add_fit_args()
in image_classification/common/fit.py
58 2 1