facebookresearch / mobile-vision
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 703 units with 5,278 lines of code in units (46.2% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (134 lines of code)
    • 32 medium size units (927 lines of code)
    • 114 small units (1,652 lines of code)
    • 555 very small units (2,565 lines of code)
0% | 2% | 17% | 31% | 48%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 2% | 17% | 31% | 48%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mobile_cv/model_zoo/tools0% | 23% | 18% | 28% | 29%
mobile_cv/arch/fbnet_v20% | 0% | 22% | 34% | 42%
mobile_cv/lut/lib0% | 0% | 11% | 28% | 59%
runtime_lut/code0% | 0% | 25% | 28% | 45%
mobile_cv/arch/layers0% | 0% | 31% | 27% | 40%
mobile_cv/predictor0% | 0% | 32% | 40% | 26%
mobile_cv/common/misc0% | 0% | 12% | 17% | 69%
mobile_cv/model_zoo/models0% | 0% | 18% | 28% | 53%
mobile_cv/arch/utils0% | 0% | 4% | 37% | 58%
runtime_lut/scripts0% | 0% | 45% | 37% | 17%
ROOT0% | 0% | 0% | 100% | 0%
mobile_cv/model_zoo/tasks0% | 0% | 0% | 23% | 76%
mobile_cv/arch/quantization0% | 0% | 0% | 28% | 71%
mobile_cv/model_zoo/datasets0% | 0% | 0% | 0% | 100%
mobile_cv/common0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def parse_args()
in mobile_cv/model_zoo/tools/model_exporter.py
75 1 1
def parse_arguments()
in mobile_cv/model_zoo/tools/create_model.py
59 3 1
def forward()
in mobile_cv/arch/layers/batch_norm.py
50 9 2
def _verify_init()
in mobile_cv/arch/fbnet_v2/fbnet_fpn.py
47 12 3
def create_fill_op()
in runtime_lut/code/model_utils.py
46 7 3
def forward()
in mobile_cv/arch/fbnet_v2/asymmetric_correlation.py
38 12 3
def __init__()
in mobile_cv/arch/fbnet_v2/irf_block.py
37 3 37
def forward()
in mobile_cv/predictor/model_wrappers.py
36 12 2
def _init_repr_shape()
in mobile_cv/lut/lib/pt/flops_utils.py
35 13 1
def __init__()
in mobile_cv/arch/fbnet_v2/blur_pool.py
33 4 5
def convert_int8_jit()
in mobile_cv/model_zoo/tools/create_model.py
32 5 4
def __init__()
in mobile_cv/arch/fbnet_v2/irf_3d_block.py
32 2 0
def convert_ModulatedConv2d()
in mobile_cv/lut/lib/pt/pt_converter.py
30 2 2
def filter_kwargs()
in mobile_cv/arch/utils/helper.py
30 13 3
def __init__()
in mobile_cv/arch/fbnet_v2/irf_3d_block.py
29 1 0
def main()
in mobile_cv/model_zoo/tools/jit_speed_benchmark.py
28 2 0
def build_bn()
in mobile_cv/arch/fbnet_v2/basic_blocks.py
28 6 5
def __init__()
in mobile_cv/arch/fbnet_v2/gb_block.py
27 1 0
def __init__()
in mobile_cv/arch/fbnet_v2/sg_block.py
27 1 0
def get_ops_from_net()
in runtime_lut/code/api.py
27 12 3