aws / sagemaker-training-toolkit
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 158 units with 1,457 lines of code in units (63.5% of code).
    • 1 very long units (142 lines of code)
    • 3 long units (181 lines of code)
    • 13 medium size units (378 lines of code)
    • 18 small units (245 lines of code)
    • 123 very small units (511 lines of code)
9% | 12% | 25% | 16% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c46% | 16% | 26% | 0% | 10%
py0% | 11% | 25% | 21% | 41%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/sagemaker_training/c46% | 16% | 26% | 0% | 10%
src/sagemaker_training0% | 11% | 26% | 21% | 41%
ROOT0% | 0% | 0% | 0% | 100%
src/sagemaker_training/cli0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int jsmn_parse()
in src/sagemaker_training/c/jsmn.c
142 73 5
def _create_command()
in src/sagemaker_training/mpi.py
68 8 1
def __init__()
in src/sagemaker_training/environment.py
62 11 4
static int jsmn_parse_string()
in src/sagemaker_training/c/jsmn.c
51 23 5
def train()
in src/sagemaker_training/trainer.py
49 7 0
static int jsmn_parse_primitive()
in src/sagemaker_training/c/jsmn.c
40 13 5
int gethostname()
in src/sagemaker_training/c/gethostname.c
39 6 2
def to_env_vars()
in src/sagemaker_training/environment.py
31 3 1
def check_error()
in src/sagemaker_training/process.py
29 7 6
def _write_spmatrix_to_sparse_tensor()
in src/sagemaker_training/recordio.py
28 10 3
def __str__()
in src/sagemaker_training/errors.py
26 6 1
def _create_command()
in src/sagemaker_training/smdataparallel.py
26 3 1
def _watch()
in src/sagemaker_training/intermediate_output.py
23 22 4
def run()
in src/sagemaker_training/smdataparallel.py
23 2 3
def run()
in src/sagemaker_training/process.py
22 2 3
def _write_numpy_to_dense_tensor()
in src/sagemaker_training/recordio.py
21 9 3
def download_and_extract()
in src/sagemaker_training/files.py
21 8 2
def to_env_vars()
in src/sagemaker_training/mapping.py
17 7 1
def to_cmd_args()
in src/sagemaker_training/mapping.py
17 8 1
def create()
in src/sagemaker_training/process.py
16 5 7