facebookresearch / VMZ
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 256 units with 5,007 lines of code in units (58.9% of code).
    • 11 very long units (1,889 lines of code)
    • 6 long units (434 lines of code)
    • 36 medium size units (1,113 lines of code)
    • 62 small units (895 lines of code)
    • 141 very small units (676 lines of code)
37% | 8% | 22% | 17% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py27% | 6% | 26% | 22% | 17%
cc64% | 7% | 19% | 5% | 3%
h50% | 21% | 6% | 15% | 7%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ops58% | 12% | 13% | 9% | 5%
c2/tools75% | 0% | 11% | 9% | 2%
pt/vmz/func56% | 10% | 27% | 6% | 0%
c2/lib/utils0% | 30% | 40% | 21% | 7%
pt/vmz/common0% | 13% | 4% | 21% | 60%
pt/vmz/models0% | 0% | 78% | 15% | 5%
utilities/model_conversion0% | 0% | 34% | 47% | 17%
c2/lib/models0% | 0% | 28% | 43% | 27%
pt/vmz/datasets0% | 0% | 50% | 34% | 14%
c2/data0% | 0% | 80% | 0% | 19%
pt/tools0% | 0% | 0% | 58% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
cc
void AVDecoder::decodeLoop()
in ops/av_decoder.cc
472 122 6
def Train()
in c2/tools/train_net.py
210 19 1
def ExtractFeatures()
in c2/tools/extract_features.py
186 8 1
def train_main()
in pt/vmz/func/train.py
172 28 1
164 41 17
132 23 0
def main()
in c2/tools/train_net.py
123 2 0
116 15 10
def parse_args()
in pt/vmz/func/opts.py
112 1 0
101 5 2
def main()
in c2/tools/extract_features.py
101 3 0
def AddVideoInput()
in c2/lib/utils/model_helper.py
96 16 3
85 11 7
71 11 13
def log_every()
in pt/vmz/common/log.py
68 6 4
bool AVInputOp::Prefetch()
in ops/av_input_op.h
62 9 0
def test_main()
in pt/vmz/func/test.py
52 6 1
cc
50 7 6
def GetFlopsAndParams()
in c2/lib/utils/model_helper.py
48 15 2
cc
bool LogSpectrum::Init()
in ops/LogMels.cc
47 11 0