Skip to content
callcount

insights

What the call data turns up

Every count on this page is derived from the snapshot: 41 functions, 384k callsites, 7 mapped projects. Here is what stands out: the loops Go runs hottest, the functions everyone reaches for, and the long tail of everything else. 27 facts in all.

deal me a curiosity

1,751in-loop calls

The function Go runs most inside loops

errors.New sits inside a loop at 31% of its 5,590 production calls.

1,751 in-loop calls. The function Go runs most inside loops.

Open this one
loops
1,751in-loop calls

The function Go runs most inside loops

errors.New sits inside a loop at 31% of its 5,590 production calls.

errors.New

loops
7functions

Half of all in-loop work comes from a handful of functions

Half of every production call that runs inside a loop traces back to just 7 of the 41 ranked functions.

loops
31%of its calls loop

The busy function that almost never leaves a loop

Among functions with real volume, errors.New runs inside a loop more than any other, 31% of its 5,590 production calls.

errors.New

breadth
236modules call it

The function with the widest reach across the ecosystem

strconv.Itoa is called from 236 of the 42 modules in the corpus, roughly 1 in every 0.2.

strconv.Itoa

breadth
40reach half the corpus

True ubiquity is rare

Only 40 functions are called in at least half of the 42 modules in the corpus. Almost everything else is niche.

projects
5of 7 projects

The function nearly every project reaches for first

fmt.Errorf is the single most-called function in 5 of the 7 projects mapped, the common denominator of Go.

fmt.Errorf

projects
15,755production calls

The heaviest caller of them all

Kubernetes makes 15,755 production calls across 24 modules, more than any other project we mapped.

Kubernetes

projects
1,680production calls

Go (golang.org/x)'s signature call

Go (golang.org/x) leans on fmt.Errorf harder than the field does. That is 1,680 production calls from its own modules.

fmt.Errorf

projects
1,116production calls

Hugo's signature call

Hugo leans on strings.Builder.WriteString harder than the field does. That is 1,116 production calls from its own modules.

strings.Builder.WriteString

projects
1,035production calls

Docker's signature call

Docker leans on github.com/sirupsen/logrus.WithField harder than the field does. That is 1,035 production calls from its own modules.

github.com/sirupsen/logrus.WithField

projects
751production calls

Kubernetes' signature call

Kubernetes leans on k8s.io/apimachinery/pkg/util/sets.New harder than the field does. That is 751 production calls from its own modules.

k8s.io/apimachinery/pkg/util/sets.New

interfaces
1,002dispatched calls

Go's busiest interface method

io.Reader.Read is dispatched more than any other interface method, 1,002 calls that could land on any implementation.

io.Reader.Read

interfaces
5%of all calls dispatch

Interfaces are everywhere, but they carry little traffic

Just 5% of the 94,690 calls in the corpus go through an interface. Most Go is concrete.

interfaces
148modules use io.Writer

Everyone writes through the same shape

148 modules call io.Writer.Write, and 71% of those calls are dispatched. The target is a file, a buffer, or a socket, decided at runtime.

io.Writer.Write

cost
~17xthe cost of Sprintf

The priciest hot path in the corpus

Weighted by how often it runs, regexp.MustCompile is the corpus's most expensive hot path, about 98x the per-call cost of fmt.Sprintf, and 5% of its calls run inside a loop.

regexp.MustCompile

cost
9.4 nsper operation

The cheapest call we benchmarked

Of the hot-path functions we benchmarked on darwin/arm64, strings.TrimSpace is the cheapest, about 9.4 nanoseconds per call.

strings.TrimSpace

cost
5%of MustCompile in loops

Go programs compile their patterns once, not in the loop

regexp.MustCompile costs about 98x a fmt.Sprintf per call, but only 5% of its calls sit inside a loop. The expensive part stays out of the hot path.

regexp.MustCompile

tests
5,140calls inside tests

The most test-bound function in the corpus

github.com/stretchr/testify/assert.Equal is called 5,140 times from tests, 100% of all its calls.

github.com/stretchr/testify/assert.Equal

tests
5,140calls inside tests

The third-party helper the test suite can't live without

github.com/stretchr/testify/assert.Equal is the most-called third-party function in tests, 5,140 calls, 100% of them in test files.

github.com/stretchr/testify/assert.Equal

tests
5,140calls, every one a test

Some functions never leave the test suite

github.com/stretchr/testify/assert.Equal is called 5,140 times, and every single call is inside a test file.

github.com/stretchr/testify/assert.Equal

generated
393of its calls generated

Even a workhorse leans on code generators

32% of google.golang.org/protobuf/proto.Marshal's 1,240 calls are emitted by code generators. The rest are hand-written.

google.golang.org/protobuf/proto.Marshal

generated
4%of all calls

How much of Go is written by code generators

4% of every call in the corpus lives in generated code, such as protobuf and cloud SDKs.

long tail
1,039production calls

The median Go function is barely called at all

Half of the 41 ranked functions are called 1,039 times or fewer in production. The famous ones are the exception.

long tail
12%of all production calls

A tiny fraction of functions does most of the work

The busiest 1% of functions, 1 of them, account for 12% of every production call. A textbook power law.

long tail
60%from the top 10

Ten functions carry a fifth of everything

Just ten functions account for 60% of all 68,399 production calls in the corpus.

long tail
94%of work from the stdlib

The standard library punches far above its weight

The 33 standard-library functions are 80% of the catalog but do 94% of all production work.

long tail
7%called at most once

Most catalogued functions are barely used

7% of the 41 ranked functions are called at most once in production code, catalogued, but rarely reached for.

Showing 27 of 27 facts.

Facts are superlatives over production calls (test and generated code excluded, except where a fact is explicitly about them). Cost figures are a coarse, input-independent benchmark seed, expressed relative to a fmt.Sprintf call. See the methodology.