awslabs / ec2-spot-labs
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 80 units with 1,282 lines of code in units (10.2% of code).
    • 1 very long units (101 lines of code)
    • 3 long units (178 lines of code)
    • 16 medium size units (475 lines of code)
    • 20 small units (295 lines of code)
    • 40 very small units (233 lines of code)
7% | 13% | 37% | 23% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py7% | 14% | 37% | 22% | 18%
java0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ec2-spot-sagemaker-managed-spot-training16% | 9% | 33% | 22% | 17%
ec2-spot-asg-handling-interruptions0% | 100% | 0% | 0% | 0%
ec2-spot-interruption-logging-insights0% | 100% | 0% | 0% | 0%
ec2-spot-interruption-handler0% | 0% | 80% | 12% | 7%
ec2-spot-deep-learning-training0% | 0% | 51% | 30% | 17%
ec2-spot-price-monitoring-with-lambda0% | 0% | 100% | 0% | 0%
ec2-spot-history-notebook0% | 0% | 100% | 0% | 0%
aws-compute-optimizer0% | 0% | 100% | 0% | 0%
tensorflow-serving-load-testing-sample0% | 0% | 58% | 25% | 16%
ec2-spot-tensorflow-checkpoint0% | 0% | 27% | 35% | 36%
builder-sessions0% | 0% | 0% | 85% | 14%
ec2-spot-duration0% | 0% | 0% | 62% | 37%
ec2-spot-analyze-costs0% | 0% | 0% | 100% | 0%
paginated-api-call-examples0% | 0% | 0% | 30% | 69%
ecs-spot-agent0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def parse_args()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-built-in-object-detection/tools/im2rec.py
101 1 0
def __init__()
in ec2-spot-asg-handling-interruptions/cdk/app.py
71 1 3
def greengrass_infinite_infer_run()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-built-in-object-detection/tools/birdsOnEdge.py
56 19 0
def lambda_handler()
in ec2-spot-interruption-logging-insights/SpotInterruptionTriggerFunction/app.py
51 4 2
def image_encode()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-built-in-object-detection/tools/im2rec.py
49 11 4
def model_fn()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-custom-tensorflow/container/cifar10/cifar10.py
42 10 3
def cifar10_resnet_v2_generator()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-custom-tensorflow/container/cifar10/resnet_model.py
37 5 3
def handler()
in ec2-spot-price-monitoring-with-lambda/ec2-spot-price-monitoring.py
35 5 2
def __init__()
in ec2-spot-history-notebook/cdk/spot_historic_notebook/spot_historic_notebook_stack.py
34 2 4
def handler()
in ec2-spot-interruption-handler/spot-interruption-handler/index.py
30 6 2
def handler()
in aws-compute-optimizer/lambda.py
29 1 2
def write_worker()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-built-in-object-detection/tools/im2rec.py
28 6 3
def run_commands_on_instance()
in ec2-spot-interruption-handler/spot-interruption-handler/index.py
25 3 2
def main()
in ec2-spot-deep-learning-training/ec2_spot_keras_training.py
25 3 0
def load_data()
in ec2-spot-deep-learning-training/download_cifar10.py
25 5 1
def runParallelRequests()
in tensorflow-serving-load-testing-sample/python/submit_mc_tf_k8s_requests.py
25 5 3
def list_image()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-built-in-object-detection/tools/im2rec.py
24 11 3
def make_list()
in ec2-spot-sagemaker-managed-spot-training/sagemaker-built-in-object-detection/tools/im2rec.py
24 7 1
def get_interruption_handling_properties()
in ec2-spot-interruption-handler/spot-interruption-handler/index.py
22 10 1
def train_and_checkpoint()
in ec2-spot-tensorflow-checkpoint/tensorflow_checkpoint.py
21 4 2