neo-ai / tvm
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 15,632 units with 187,724 lines of code in units (66.5% of code).
    • 122 very long units (17,256 lines of code)
    • 413 long units (27,951 lines of code)
    • 1,825 medium size units (56,795 lines of code)
    • 2,652 small units (38,458 lines of code)
    • 10,620 very small units (47,264 lines of code)
9% | 14% | 30% | 20% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 17% | 29% | 19% | 23%
cc8% | 13% | 32% | 22% | 23%
h8% | 10% | 25% | 18% | 37%
c17% | 21% | 26% | 17% | 16%
go9% | 17% | 22% | 20% | 30%
ts0% | 16% | 46% | 15% | 21%
java0% | 8% | 23% | 21% | 46%
mm0% | 19% | 43% | 15% | 22%
rs0% | 0% | 24% | 27% | 48%
pxi0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
python10% | 16% | 29% | 19% | 24%
src8% | 13% | 31% | 22% | 23%
nnvm25% | 8% | 23% | 21% | 21%
vta21% | 23% | 27% | 11% | 16%
include7% | 8% | 27% | 13% | 42%
apps3% | 30% | 33% | 13% | 18%
golang9% | 16% | 23% | 19% | 31%
tutorials0% | 18% | 37% | 18% | 25%
web0% | 12% | 39% | 24% | 23%
jvm0% | 3% | 14% | 27% | 54%
rust0% | 0% | 21% | 27% | 50%
ROOT0% | 0% | 91% | 0% | 8%
neo-tools0% | 0% | 64% | 0% | 35%
conda0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void StackVM::Run()
in src/runtime/stackvm/stackvm.cc
354 79 1
int TVMGraphExecutorGraphAttr_Load()
in src/runtime/crt/graph_executor/graph_executor.c
293 56 2
def InjectDMAIntrin()
in vta/python/vta/transform.py
243 53 0
def conv2d_strategy_cuda()
in python/tvm/relay/op/strategy/cuda.py
243 74 4
void VirtualMachine::RunLoop()
in src/runtime/vm/vm.cc
233 34 0
def _alter_conv2d_layout()
in python/tvm/topi/arm_cpu/conv2d_alter_op.py
225 28 4
def _qnn_conv()
in python/tvm/relay/frontend/mxnet.py
219 40 4
ComputeDAG ComputeDAG::RewriteLayout()
in src/auto_scheduler/compute_dag.cc
217 47 2
def create_convert_map()
in python/tvm/relay/frontend/pytorch.py
212 2 1
inline Tensor einsum()
in include/tvm/topi/einsum.h
205 49 4
def gemm_4x4_int8_int8_int32()
in python/tvm/topi/arm_cpu/tensor_intrin.py
204 18 5
Array Schedule::rfactor()
in src/te/schedule/schedule_dataflow_rewrite.cc
196 37 3
def _alter_conv2d_layout()
in python/tvm/topi/cuda/conv2d_alter_op.py
196 34 4
inline Token TokenizeOnce()
in src/parser/tokenizer.h
195 56 0
def InjectALUIntrin()
in vta/python/vta/transform.py
194 34 0
def schedule_ndhwc_tensorcore_cuda()
in python/tvm/topi/cuda/conv3d_ndhwc_tensorcore.py
192 17 3
def schedule_nhwc_tensorcore_cuda()
in python/tvm/topi/cuda/conv2d_nhwc_tensorcore.py
191 17 3
def _alter_conv2d_layout()
in python/tvm/topi/x86/conv2d_alter_op.py
190 16 4
def schedule_hwnc_tensorcore_cuda()
in python/tvm/topi/cuda/conv2d_hwnc_tensorcore.py
184 11 3
def schedule_batch_matmul_tensorcore()
in python/tvm/topi/cuda/batch_matmul_tensorcore.py
182 23 2