golang / perf
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 260 units with 4,256 lines of code in units (76.1% of code).
    • 0 very long units (0 lines of code)
    • 14 long units (904 lines of code)
    • 52 medium size units (1,686 lines of code)
    • 62 small units (916 lines of code)
    • 132 very small units (750 lines of code)
0% | 21% | 39% | 21% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 21% | 39% | 21% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal/stats0% | 24% | 25% | 25% | 24%
analysis/app0% | 26% | 50% | 15% | 6%
benchstat0% | 30% | 38% | 16% | 15%
storage/db0% | 11% | 57% | 13% | 17%
storage/cmd0% | 60% | 0% | 32% | 7%
cmd/benchsave0% | 37% | 0% | 55% | 6%
cmd/benchstat0% | 89% | 0% | 0% | 10%
storage/benchfmt0% | 0% | 57% | 22% | 19%
storage/app0% | 0% | 84% | 0% | 15%
storage0% | 0% | 47% | 19% | 33%
storage/query0% | 0% | 100% | 0% | 0%
internal/diff0% | 0% | 66% | 33% | 0%
storage/localperfdata0% | 0% | 100% | 0% | 0%
storage/appengine0% | 0% | 23% | 65% | 11%
internal/basedir0% | 0% | 0% | 100% | 0%
analysis/localperf0% | 0% | 0% | 73% | 26%
analysis/appengine0% | 0% | 0% | 57% | 42%
storage/fs0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in benchstat/table.go
91 26 1
func()
in analysis/app/trend.go
88 15 1
func MannWhitneyUTest()
in internal/stats/utest.go
80 27 3
func()
in storage/db/query.go
70 28 1
func tableToJS()
in analysis/app/trend.go
63 16 2
func()
in analysis/app/compare.go
61 17 1
func makeUmemo()
in internal/stats/udist.go
61 15 3
func main()
in storage/cmd/reindex/reindex.go
60 16 0
func main()
in cmd/benchsave/benchsave.go
59 15 0
func InvCDF()
in internal/stats/dist.go
56 14 1
func FormatText()
in benchstat/text.go
56 20 2
func NewScaler()
in benchstat/scaler.go
54 22 2
func main()
in cmd/benchstat/main.go
53 13 0
func()
in internal/stats/normaldist.go
52 6 1
func()
in storage/db/db.go
48 10 1
func()
in storage/db/db.go
47 10 1
func toCSV()
in benchstat/text.go
47 12 2
func parseQueryString()
in analysis/app/parse.go
46 14 1
func queryToTable()
in analysis/app/trend.go
45 11 1
func()
in storage/benchfmt/benchfmt.go
43 11 1