awslabs / or-rl-benchmarks
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 500 units with 5,249 lines of code in units (87.7% of code).
    • 2 very long units (267 lines of code)
    • 1 long units (52 lines of code)
    • 45 medium size units (1,341 lines of code)
    • 130 small units (1,847 lines of code)
    • 322 very small units (1,742 lines of code)
5% | <1% | 25% | 35% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | <1% | 25% | 35% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Vehicle Routing Problem/src37% | 0% | 29% | 20% | 13%
News Vendor/src0% | 23% | 45% | 11% | 19%
Bin Packing/src0% | 0% | 53% | 28% | 17%
Bin Packing/common/sagemaker_rl0% | 0% | 18% | 43% | 38%
common/sagemaker_rl0% | 0% | 18% | 43% | 38%
Vehicle Routing Problem/common/sagemaker_rl0% | 0% | 18% | 43% | 38%
News Vendor/common/sagemaker_rl0% | 0% | 18% | 43% | 38%
Bin Packing/common0% | 0% | 31% | 28% | 39%
common0% | 0% | 31% | 28% | 39%
Vehicle Routing Problem/common0% | 0% | 31% | 28% | 39%
News Vendor/common0% | 0% | 31% | 28% | 39%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_or_solution()
in Vehicle Routing Problem/src/baseline_model.py
160 79 2
def __init__()
in Vehicle Routing Problem/src/vrp_environment.py
107 6 2
def baseline()
in News Vendor/src/heuristic_baseline.py
52 8 3
def __orig_step()
in Vehicle Routing Problem/src/vrp_environment.py
43 8 2
def wait_for_s3_object()
in Bin Packing/common/misc.py
42 12 10
def wait_for_s3_object()
in common/misc.py
42 12 10
def wait_for_s3_object()
in Vehicle Routing Problem/common/misc.py
42 12 10
def wait_for_s3_object()
in News Vendor/common/misc.py
42 12 10
def step()
in Bin Packing/src/bin_packing_environment.py
37 7 2
def __update_bin_type_distribution_map()
in Bin Packing/src/bin_packing_environment.py
34 15 2
def execute_plan()
in Vehicle Routing Problem/src/baseline_model.py
34 15 2
def _build_mpi_command()
in Bin Packing/common/sagemaker_rl/mpi_launcher.py
33 8 1
def _build_mpi_command()
in common/sagemaker_rl/mpi_launcher.py
33 8 1
def _build_mpi_command()
in Vehicle Routing Problem/common/sagemaker_rl/mpi_launcher.py
33 8 1
def _build_mpi_command()
in News Vendor/common/sagemaker_rl/mpi_launcher.py
33 8 1
def get_experiment_config()
in Bin Packing/src/train_ppo.py
32 1 1
def step()
in Bin Packing/src/bin_packing_environment.py
32 6 2
def step()
in News Vendor/src/news_vendor_environment.py
32 5 2
def get_config_args()
in Bin Packing/common/sagemaker_rl/coach_launcher.py
31 11 2
def get_config_args()
in common/sagemaker_rl/coach_launcher.py
31 11 2