facebookresearch / ConvNeXt
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 111 units with 1,859 lines of code in units (46.7% of code).
    • 2 very long units (327 lines of code)
    • 3 long units (179 lines of code)
    • 22 medium size units (761 lines of code)
    • 13 small units (190 lines of code)
    • 71 very small units (402 lines of code)
17% | 9% | 40% | 10% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py17% | 9% | 40% | 10% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT30% | 7% | 35% | 9% | 17%
object_detection/mmcv_custom0% | 31% | 62% | 0% | 6%
semantic_segmentation/mmcv_custom0% | 31% | 62% | 0% | 6%
object_detection/mmcv_custom/runner0% | 0% | 100% | 0% | 0%
semantic_segmentation/mmcv_custom/apex_runner0% | 0% | 100% | 0% | 0%
object_detection/mmdet/models0% | 0% | 30% | 27% | 41%
semantic_segmentation/backbone0% | 0% | 30% | 27% | 41%
models0% | 0% | 18% | 16% | 64%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in main.py
226 34 1
101 32 18
def create_optimizer()
in optim_factory.py
77 38 6
def _log_info()
in object_detection/mmcv_custom/customized_text.py
51 19 3
def _log_info()
in semantic_segmentation/mmcv_custom/customized_text.py
51 19 3
def add_params()
in object_detection/mmcv_custom/layer_decay_optimizer_constructor.py
46 11 5
def add_params()
in semantic_segmentation/mmcv_custom/layer_decay_optimizer_constructor.py
46 11 5
def log_every()
in utils.py
45 7 4
def save_checkpoint()
in object_detection/mmcv_custom/runner/checkpoint.py
45 12 4
def save_checkpoint()
in semantic_segmentation/mmcv_custom/apex_runner/checkpoint.py
45 12 4
def build_transform()
in datasets.py
41 9 2
41 13 4
def get_parameter_groups()
in optim_factory.py
36 9 3
35 15 6
def __init__()
in object_detection/mmdet/models/backbones/convnext.py
33 7 16
def __init__()
in semantic_segmentation/backbone/convnext.py
33 7 16
def __init__()
in models/convnext.py
32 6 14
32 5 1
32 1 0
def main()
in run_with_submitit.py
31 4 0