aws-samples / aws-marketplace-machine-learning
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 22 units with 436 lines of code in units (89.7% of code).
    • 1 very long units (130 lines of code)
    • 1 long units (57 lines of code)
    • 3 medium size units (88 lines of code)
    • 6 small units (95 lines of code)
    • 11 very small units (66 lines of code)
29% | 13% | 20% | 21% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py29% | 13% | 20% | 21% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
right_size_your_sagemaker_endpoints31% | 13% | 21% | 23% | 9%
listing_torchserve_models/src0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def create_infra()
in right_size_your_sagemaker_endpoints/api_helper.py
130 2 3
def generate_plots()
in right_size_your_sagemaker_endpoints/load_test_helper.py
57 9 4
def get_pricing()
in right_size_your_sagemaker_endpoints/load_test_helper.py
32 9 2
def deploy_single_endpoint()
in right_size_your_sagemaker_endpoints/sagemaker_helper.py
32 7 3
def delete_infra()
in right_size_your_sagemaker_endpoints/api_helper.py
24 3 4
def get_min_max_instances()
in right_size_your_sagemaker_endpoints/load_test_helper.py
19 6 3
def generate_latency_plot()
in right_size_your_sagemaker_endpoints/load_test_helper.py
18 4 2
def predict()
in right_size_your_sagemaker_endpoints/locust_file.py
18 3 1
def input_fn()
in right_size_your_sagemaker_endpoints/inference.py
15 4 2
def run_load_tests()
in right_size_your_sagemaker_endpoints/load_test_helper.py
13 5 2
def clean_up_endpoints()
in right_size_your_sagemaker_endpoints/sagemaker_helper.py
12 4 1
def deploy_endpoints()
in right_size_your_sagemaker_endpoints/sagemaker_helper.py
10 3 3
def get_inference_specification_json()
in listing_torchserve_models/src/inference_specification.py
9 3 5
def get_existing_endpoints()
in right_size_your_sagemaker_endpoints/sagemaker_helper.py
8 3 0
def get_validation_specification_json()
in listing_torchserve_models/src/modelpackage_validation_specification.py
7 1 7
def get_supported_instances()
in listing_torchserve_models/src/inference_specification.py
7 2 2
def checker()
in right_size_your_sagemaker_endpoints/locust_file.py
7 3 1
def predict_fn()
in right_size_your_sagemaker_endpoints/inference.py
6 2 2
def model_fn()
in right_size_your_sagemaker_endpoints/inference.py
5 1 1
def on_locust_init()
in right_size_your_sagemaker_endpoints/locust_file.py
3 1 2