facebookresearch / deepfloat
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 226 units with 1,857 lines of code in units (5.2% of code).
    • 1 very long units (154 lines of code)
    • 1 long units (59 lines of code)
    • 13 medium size units (316 lines of code)
    • 43 small units (649 lines of code)
    • 168 very small units (679 lines of code)
8% | 3% | 17% | 34% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp60% | 0% | 9% | 19% | 10%
py0% | 5% | 24% | 41% | 29%
h0% | 0% | 4% | 28% | 66%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cpp/utils28% | 0% | 4% | 19% | 48%
py0% | 12% | 26% | 46% | 14%
rtl/log0% | 0% | 23% | 38% | 37%
cpp/ops0% | 0% | 13% | 48% | 37%
bitstream0% | 0% | 0% | 0% | 100%
cpp0% | 0% | 0% | 0% | 100%
cpp/layers0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
std::string oclErrorToString()
in cpp/utils/OpenCLUtils.cpp
154 49 1
def validate()
in py/validate.py
59 8 4
def get_pow2_delta_expansion()
in rtl/log/luts/gen_tables.py
28 6 4
def get_log2_delta_expansion()
in rtl/log/luts/gen_tables.py
28 6 4
def get_fpga_mods()
in py/run_fpga_resnet.py
25 8 1
def __init__()
in py/fpga_resnet.py
25 1 8
def toDecimalString()
in rtl/log/luts/FixedPoint.py
25 9 3
def __init__()
in py/fpga_resnet.py
24 1 9
def forward()
in py/fpga_resnet.py
24 1 5
void validatePointwiseArgs()
in cpp/ops/TensorMath.cpp
24 9 3
def get_pow2_expansion()
in rtl/log/luts/gen_tables.py
24 8 4
def get_log2_expansion()
in rtl/log/luts/gen_tables.py
23 8 4
def forward()
in py/fpga_resnet.py
22 2 5
Event call()
in cpp/utils/Kernel.h
22 1 4
def atan()
in rtl/log/luts/FixedPoint.py
22 7 1
def fuse_resnet_params()
in py/examine_resnet.py
20 5 1
def make_loader()
in py/validate.py
20 2 3
def init_fpga()
in py/fpga.py
19 1 2
OpType compareOpToDeviceOp()
in cpp/ops/TensorMath.cpp
19 7 1
OpType mathOpToDeviceOp()
in cpp/ops/TensorMath.cpp
19 7 1