facebookresearch / mvp
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 479 units with 5,458 lines of code in units (62.4% of code).
    • 8 very long units (1,186 lines of code)
    • 12 long units (910 lines of code)
    • 36 medium size units (1,101 lines of code)
    • 39 small units (599 lines of code)
    • 384 very small units (1,662 lines of code)
21% | 16% | 20% | 10% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py27% | 14% | 29% | 14% | 13%
h11% | 18% | 4% | 6% | 59%
cpp30% | 25% | 33% | 9% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
extensions/mvpraymarch24% | 24% | 9% | 8% | 33%
data75% | 0% | 6% | 7% | 11%
models/decoders32% | 43% | 12% | 4% | 6%
models19% | 0% | 34% | 22% | 23%
extensions/utils0% | 13% | 10% | 4% | 71%
utils0% | 0% | 66% | 10% | 22%
models/bg0% | 0% | 52% | 27% | 20%
models/encoders0% | 0% | 62% | 37% | 0%
models/raymarchers0% | 0% | 64% | 23% | 11%
models/colorcals0% | 0% | 0% | 50% | 50%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def forward()
in models/decoders/mvp.py
202 47 10
def gradcheck()
in extensions/mvpraymarch/mvpraymarch.py
200 20 14
def forward()
in models/volumetric.py
181 48 28
def __getitem__()
in data/multiviewvideo.py
163 49 2
static __device__ float3 grid_sample_backward()
in extensions/mvpraymarch/utils.h
114 11 9
113 10 9
def __init__()
in data/multiviewvideo.py
112 26 34
std::vector raymarch_backward()
in extensions/mvpraymarch/mvpraymarch.cpp
101 26 33
def gradcheck()
in extensions/utils/utils.py
100 13 0
def forward()
in models/decoders/nv.py
88 30 10
__global__ void raymarch_subset_backward_kernel()
in extensions/mvpraymarch/mvpraymarch_subset_kernel.h
85 21 14
std::vector raymarch_forward()
in extensions/mvpraymarch/mvpraymarch.cpp
83 20 27
def __init__()
in models/decoders/mvp.py
82 14 13
80 18 12
static __device__ out_t grid_sample_forward()
in extensions/mvpraymarch/utils.h
76 11 7
75 10 7
def forward()
in extensions/mvpraymarch/mvpraymarch.py
71 23 13
__global__ void raymarch_subset_forward_kernel()
in extensions/mvpraymarch/mvpraymarch_subset_kernel.h
66 13 14
def __init__()
in models/decoders/nv.py
53 7 18
def __init__()
in models/decoders/mvp.py
51 21 16