facebookresearch / loop_tool
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 283 units with 4,992 lines of code in units (60.8% of code).
    • 6 very long units (867 lines of code)
    • 20 long units (1,326 lines of code)
    • 45 medium size units (1,391 lines of code)
    • 49 small units (736 lines of code)
    • 163 very small units (672 lines of code)
17% | 26% | 27% | 14% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp16% | 31% | 31% | 13% | 7%
py60% | 0% | 13% | 4% | 22%
h0% | 0% | 0% | 32% | 67%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/core19% | 27% | 34% | 10% | 7%
loop_tool_py93% | 0% | 0% | 0% | 6%
src/backends/cuda15% | 43% | 13% | 19% | 7%
src/frontends0% | 31% | 37% | 18% | 12%
src/backends/cpu0% | 42% | 31% | 25% | 0%
ROOT0% | 0% | 36% | 12% | 50%
include/loop_tool0% | 0% | 0% | 33% | 66%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
std::vector unify()
in src/core/symbolic.cpp
215 54 1
def ui()
in loop_tool_py/ui.py
183 47 3
141 37 2
Expr Expr::simplify()
in src/core/symbolic.cpp
116 38 0
std::string gen_loop()
in src/backends/cuda/cuda.cpp
108 27 5
104 21 2
IR::NodeRef TensorImpl::resolve()
in src/frontends/lazy.cpp
97 23 3
InnerFnType gen_vec_add()
in src/backends/cpu/unroll_contiguous.cpp
89 7 4
88 26 1
82 24 1
81 20 2
InnerFnType gen_parallel_loop()
in src/core/compile.cpp
72 10 4
std::string gen_access()
in src/backends/cuda/cuda.cpp
69 22 6
std::string Compiler::gen_string()
in src/core/compile.cpp
68 15 2
std::string Expr::dump()
in src/core/symbolic.cpp
62 19 1
std::string IR::dump()
in src/core/ir.cpp
61 16 1
std::string gen_node()
in src/backends/cuda/cuda.cpp
61 12 4
std::string gen_mem_decl()
in src/backends/cuda/cuda.cpp
59 16 5
std::string dot()
in src/core/ir.cpp
58 12 1
std::string gen_guard()
in src/backends/cuda/cuda.cpp
57 13 5