facebookresearch / robust_cvd
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 972 units with 12,448 lines of code in units (67.9% of code).
    • 8 very long units (1,257 lines of code)
    • 30 long units (2,153 lines of code)
    • 124 medium size units (3,788 lines of code)
    • 157 small units (2,264 lines of code)
    • 653 very small units (2,986 lines of code)
10% | 17% | 30% | 18% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp16% | 22% | 30% | 13% | 16%
py6% | 15% | 33% | 23% | 22%
h0% | 4% | 19% | 15% | 59%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib18% | 25% | 27% | 11% | 17%
ROOT22% | 16% | 29% | 21% | 9%
loss0% | 49% | 24% | 0% | 26%
raft/core0% | 7% | 45% | 29% | 18%
lib/core0% | 3% | 29% | 20% | 47%
loaders0% | 35% | 39% | 0% | 25%
raft0% | 22% | 19% | 38% | 18%
optimizer0% | 29% | 44% | 22% | 4%
utils0% | 0% | 33% | 30% | 35%
monodepth/midas_v20% | 0% | 39% | 25% | 35%
monodepth0% | 0% | 0% | 50% | 50%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def fine_tune()
in depth_fine_tuning.py
240 64 2
228 43 1
199 43 1
139 26 3
void DepthVideo::load()
in lib/DepthVideo.cpp
121 19 1
118 25 2
def dynamic_mask_generation()
in dynamic_mask_generation.py
111 23 1
101 17 1
def add_arguments()
in loss/loss_params.py
100 1 1
def geometry_consistency_loss()
in loss/consistency_loss.py
97 16 4
void GridDepthXform::linearGather()
in lib/DepthMapTransform.cpp
97 10 4
95 1 1
def scene_flow_loss()
in loss/scene_flow_loss.py
87 16 4
void XformDescriptor::parse()
in lib/DepthMapTransform.cpp
87 19 1
82 19 3
void GridDepthXform::cubicGather()
in lib/DepthMapTransform.cpp
81 26 4
81 21 2
81 11 4
80 17 1
80 11 2