facebookresearch / NSVF
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 500 units with 5,387 lines of code in units (75.6% of code).
    • 0 very long units (0 lines of code)
    • 15 long units (988 lines of code)
    • 59 medium size units (1,780 lines of code)
    • 63 small units (955 lines of code)
    • 363 very small units (1,664 lines of code)
0% | 18% | 33% | 17% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 20% | 32% | 18% | 28%
cpp0% | 0% | 78% | 15% | 5%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
fairnr_cli0% | 55% | 28% | 4% | 11%
fairnr/modules0% | 11% | 33% | 25% | 29%
fairnr/data0% | 15% | 19% | 20% | 44%
fairnr0% | 59% | 11% | 21% | 7%
fairnr/criterions0% | 32% | 0% | 46% | 21%
fairnr/tasks0% | 22% | 53% | 13% | 10%
fairnr/clib0% | 21% | 70% | 0% | 8%
fairnr/models0% | 0% | 44% | 13% | 42%
fairnr/clib/src0% | 0% | 78% | 15% | 5%
fairnr/clib/include0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in fairnr/data/shape_dataset.py
87 25 17
def main()
in fairnr_cli/validate.py
87 23 2
def forward_chunk()
in fairnr/modules/renderer.py
83 23 11
def launch_cluster()
in fairnr_cli/launch_slurm.py
80 13 2
def generate()
in fairnr/renderer.py
77 18 4
def _main()
in fairnr_cli/render_multigpu.py
71 15 2
def __init__()
in fairnr/modules/encoder.py
66 18 5
def compute_loss()
in fairnr/criterions/rendering_loss.py
58 17 5
def main()
in fairnr_cli/train.py
56 21 2
def __init__()
in fairnr/tasks/neural_rendering.py
55 22 2
def _main()
in fairnr_cli/render.py
55 12 2
def __init__()
in fairnr/renderer.py
54 12 10
def forward()
in fairnr/clib/__init__.py
53 7 8
def forward()
in fairnr/modules/field.py
53 17 4
def sample_pixel_from_image()
in fairnr/data/data_utils.py
53 13 8
def train()
in fairnr_cli/train.py
50 11 4
def add_args()
in fairnr/tasks/neural_rendering.py
49 1 1
def train_step()
in fairnr/tasks/neural_rendering.py
46 28 7
def add_eval_scores()
in fairnr/models/fairnr_model.py
45 15 9
def sample_pixels()
in fairnr/modules/reader.py
45 11 6