facebookresearch / fvcore
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 226 units with 1,485 lines of code in units (58.3% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (54 lines of code)
    • 8 medium size units (242 lines of code)
    • 22 small units (323 lines of code)
    • 195 very small units (866 lines of code)
0% | 3% | 16% | 21% | 58%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 3% | 16% | 21% | 58%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
fvcore/nn0% | 8% | 15% | 17% | 59%
fvcore/common0% | 0% | 14% | 25% | 59%
fvcore/transforms0% | 0% | 21% | 21% | 57%
ROOT0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _analyze()
in fvcore/nn/jit_analysis.py
54 14 1
def _load_model()
in fvcore/common/checkpoint.py
45 14 2
def _model_stats_str()
in fvcore/nn/print_model_statistics.py
39 9 4
def parameter_count_table()
in fvcore/nn/parameter_count.py
34 10 2
def einsum_flop_jit()
in fvcore/nn/jit_handles.py
27 11 2
def decorator()
in fvcore/common/benchmark.py
27 6 2
def __repr__()
in fvcore/transforms/transform.py
27 7 1
def apply_image()
in fvcore/transforms/transform.py
22 9 3
def apply_polygons()
in fvcore/transforms/transform.py
21 10 2
def _log_incompatible_keys()
in fvcore/common/checkpoint.py
19 5 2
def step()
in fvcore/common/checkpoint.py
19 8 3
def to_float_tensor()
in fvcore/transforms/transform_util.py
18 5 1
def register_type()
in fvcore/transforms/transform.py
18 2 3
def fill()
in fvcore/nn/print_model_statistics.py
17 8 2
def _strip_prefix_if_present()
in fvcore/common/checkpoint.py
17 13 3
def _warn_uncalled_mods()
in fvcore/nn/jit_analysis.py
16 5 2
def _format_size()
in fvcore/nn/print_model_statistics.py
16 8 3
16 3 0
def __call__()
in fvcore/common/param_scheduler.py
15 5 2
def save()
in fvcore/common/checkpoint.py
15 4 3