microsoft / EdgeML
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 9,661 units with 96,810 lines of code in units (43.1% of code).
    • 93 very long units (16,638 lines of code)
    • 221 long units (14,866 lines of code)
    • 708 medium size units (22,602 lines of code)
    • 989 small units (14,332 lines of code)
    • 7,650 very small units (28,372 lines of code)
17% | 15% | 23% | 14% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c75% | 10% | 11% | 1% | 1%
h8% | 14% | 22% | 15% | 38%
py19% | 17% | 27% | 16% | 19%
cpp16% | 18% | 25% | 16% | 23%
hh0% | 11% | 11% | 16% | 60%
ino0% | 22% | 55% | 13% | 7%
cxx0% | 27% | 10% | 54% | 7%
js0% | 0% | 70% | 17% | 12%
cs0% | 0% | 50% | 42% | 7%
cc0% | 0% | 39% | 45% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cpp/eigen14% | 14% | 20% | 14% | 35%
tools/SeeDot18% | 16% | 26% | 18% | 21%
cpp/src22% | 23% | 28% | 16% | 9%
c_reference/src42% | 24% | 27% | 1% | 2%
tf/edgeml_tf23% | 14% | 34% | 18% | 9%
c_reference/models100% | 0% | 0% | 0% | 0%
pytorch/edgeml_pytorch18% | 12% | 39% | 17% | 12%
applications/GesturePod8% | 10% | 18% | 11% | 50%
cpp/drivers46% | 23% | 22% | 8% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def expr()
in tools/SeeDot/seedot/compiler/antlr/seedotParser.py
573 39 2
def translateToC()
in tools/SeeDot/seedot/compiler/codegen/m3.py
462 75 3
int ctbmv_()
in cpp/eigen/blas/f2c/ctbmv.c
420 69 12
int ztbmv_()
in cpp/eigen/blas/f2c/ztbmv.c
420 69 12
int main()
in tools/SeeDot/seedot/Predictor/main.cpp
345 77 2
void EdgeML::altMinSGD()
in cpp/src/ProtoNN/ProtoNNFunctions.cpp
338 22 4
void minimum_degree_ordering()
in cpp/eigen/Eigen/src/OrderingMethods/Amd.h
317 68 2
int zhbmv_()
in cpp/eigen/blas/f2c/zhbmv.c
283 43 12
int chbmv_()
in cpp/eigen/blas/f2c/chbmv.c
282 43 12
void q_face_detection()
in c_reference/models/quantized_face_detection.c
276 12 1
int chpmv_()
in cpp/eigen/blas/f2c/chpmv.c
271 40 10
int zhpmv_()
in cpp/eigen/blas/f2c/zhpmv.c
271 40 10
static void initializeDeviceProp()
in cpp/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h
240 18 0
void q7_mbconv_block()
in c_reference/src/quantized_mbconv.c
238 27 43
void q7xq15_q15_mbconv_block()
in c_reference/src/quantized_mbconv.c
238 27 43
void q15xq7_q7_mbconv_block()
in c_reference/src/quantized_mbconv.c
238 27 43
void q15xq7_q15_mbconv_block()
in c_reference/src/quantized_mbconv.c
238 27 43
void q15_mbconv_block()
in c_reference/src/quantized_mbconv.c
238 27 43
def visitMbconv()
in tools/SeeDot/seedot/compiler/ir/irBuilder.py
214 31 2
def train()
in tf/edgeml_tf/trainer/bonsaiTrainer.py
212 47 10