facebookresearch / DONERF
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 236 units with 3,660 lines of code in units (87.0% of code).
    • 4 very long units (478 lines of code)
    • 10 long units (749 lines of code)
    • 37 medium size units (1,182 lines of code)
    • 40 small units (571 lines of code)
    • 145 very small units (680 lines of code)
13% | 20% | 32% | 15% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py13% | 20% | 32% | 15% | 18%
cpp0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src11% | 19% | 34% | 15% | 18%
src/util19% | 26% | 21% | 16% | 16%
src/native0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def init()
in src/util/config.py
137 5 3
def initialize()
in src/train_data.py
119 33 5
def main()
in src/prepare_dataset.py
112 19 0
def generate_data()
in src/evaluate.py
110 31 3
def color_space_transform()
in src/util/flip_loss.py
96 18 2
def info_content_weight_map()
in src/util/IW_SSIM_PyTorch.py
86 14 3
def pre_train()
in src/train.py
79 22 1
def train()
in src/train.py
78 30 1
def load_config()
in src/evaluate.py
77 37 7
def main()
in src/evaluate.py
76 23 0
def render_all_imgs()
in src/plots.py
74 27 3
def batch()
in src/features.py
66 23 3
def render_img()
in src/plots.py
64 20 4
def __init__()
in src/models.py
53 23 8
def export_onnx()
in src/export.py
48 9 2
def validate_batch()
in src/train.py
47 6 4
def __init__()
in src/datasets.py
44 8 6
def batch()
in src/features.py
44 7 3
def __init__()
in src/features.py
44 10 5
def __init__()
in src/datasets.py
41 11 3