golang / sys
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 6,356 units with 57,383 lines of code in units (34.2% of code).
    • 8 very long units (1,890 lines of code)
    • 14 long units (844 lines of code)
    • 143 medium size units (4,250 lines of code)
    • 1,732 small units (23,451 lines of code)
    • 4,459 very small units (26,948 lines of code)
3% | 1% | 7% | 40% | 46%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go3% | 1% | 7% | 40% | 46%
c0% | 0% | 0% | 61% | 38%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
unix3% | <1% | 4% | 44% | 46%
plan917% | 0% | 8% | 49% | 25%
cpu0% | 26% | 38% | 15% | 19%
unix/internal0% | 51% | 24% | 8% | 15%
windows/mkwinsyscall0% | 18% | 23% | 25% | 32%
windows/svc0% | 13% | 45% | 23% | 18%
unix/linux0% | 12% | 57% | 16% | 14%
windows0% | <1% | 10% | 21% | 67%
windows/registry0% | 0% | 42% | 22% | 34%
execabs0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func main()
in unix/mksyscall_aix_ppc64.go
354 89 0
func main()
in unix/mksyscall_aix_ppc.go
266 85 0
func main()
in plan9/mksyscall.go
246 76 0
func main()
in unix/mksyscall.go
243 76 0
func anyToSockaddr()
in unix/syscall_linux.go
230 41 2
func main()
in unix/mksyscall_solaris.go
193 46 0
func main()
in unix/mksysctl_openbsd.go
191 24 0
func GetsockoptTCPInfo()
in unix/syscall_zos_s390x.go
167 32 3
82 22 3
func newFn()
in windows/mkwinsyscall/mkwinsyscall.go
71 17 1
func serviceMain()
in windows/svc/service.go
67 12 2
func archInit()
in cpu/cpu_x86.go
64 13 0
func filter()
in unix/internal/mkmerge/mkmerge.go
62 18 2
61 19 0
func main()
in unix/linux/mksysnum.go
60 16 0
func()
in windows/mkwinsyscall/mkwinsyscall.go
56 12 1
func EscapeArg()
in windows/exec_windows.go
56 14 1
func merge()
in unix/internal/mkmerge/mkmerge.go
55 13 2
func Faccessat()
in unix/syscall_linux.go
54 16 4
func filterImports()
in unix/internal/mkmerge/mkmerge.go
54 14 1