aws-samples / aws-lambda-inference-cdk-compute-blog
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 7 units with 462 lines of code in units (82.4% of code).
    • 2 very long units (266 lines of code)
    • 1 long units (83 lines of code)
    • 3 medium size units (99 lines of code)
    • 1 small units (14 lines of code)
    • 0 very small units (0 lines of code)
57% | 17% | 21% | 3% | 0%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts76% | 23% | 0% | 0% | 0%
py0% | 0% | 87% | 12% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib76% | 23% | 0% | 0% | 0%
ml-images/efs0% | 0% | 100% | 0% | 0%
ml-images/oci0% | 0% | 100% | 0% | 0%
ml-images/s30% | 0% | 60% | 40% | 0%
Alternative Visuals
Longest Units
Top 7 longest units
Unit# linesMcCabe index# params
constructor()
in lib/ml-s3-stack.ts
158 1 3
constructor()
in lib/ml-efs-stack.ts
108 1 3
constructor()
in lib/ml-oci-stack.ts
83 1 3
def lambda_handler()
in ml-images/efs/app.py
42 5 2
def lambda_handler()
in ml-images/oci/app.py
36 3 2
def lambda_handler()
in ml-images/s3/app.py
21 1 2
def util_dl_s3_model()
in ml-images/s3/app.py
14 2 0