golang / debug
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 227 units with 4,283 lines of code in units (89.1% of code).
    • 6 very long units (933 lines of code)
    • 15 long units (1,010 lines of code)
    • 30 medium size units (994 lines of code)
    • 41 small units (645 lines of code)
    • 135 very small units (701 lines of code)
21% | 23% | 23% | 15% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go21% | 23% | 23% | 15% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal/gocore26% | 26% | 19% | 11% | 16%
cmd/viewcore32% | 20% | 25% | 14% | 7%
internal/core0% | 25% | 32% | 22% | 19%
dwtest0% | 0% | 29% | 34% | 36%
internal/testenv0% | 0% | 0% | 24% | 75%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in internal/gocore/process.go
231 42 1
func serveHTML()
in cmd/viewcore/html.go
189 37 3
func()
in internal/gocore/dwarf.go
145 37 1
func htmlObject()
in cmd/viewcore/html.go
126 43 6
func()
in internal/gocore/dwarf.go
124 33 1
func()
in internal/gocore/type.go
118 30 1
func()
in internal/gocore/type.go
96 29 1
func()
in internal/gocore/object.go
81 19 1
func()
in internal/gocore/process.go
78 14 1
func Core()
in internal/core/process.go
75 20 3
func runReachable()
in cmd/viewcore/main.go
73 15 2
func()
in internal/gocore/type.go
73 20 1
func()
in internal/gocore/process.go
69 16 1
func runObjgraph()
in cmd/viewcore/main.go
63 11 2
func runRoot()
in cmd/viewcore/main.go
62 12 2
func()
in internal/core/process.go
60 20 1
func()
in internal/core/mapping.go
59 19 1
func()
in internal/gocore/process.go
58 15 1
func()
in internal/gocore/reverse.go
55 2 1
func()
in internal/gocore/dominator.go
54 13 1