Skip to content
callcount

insights

What the call data turns up

Every count on this page is derived from the snapshot: 8,901 functions, 31.13M callsites, 47 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

87,333in-loop calls

The function Go runs most inside loops

encoding/json.Unmarshal sits inside a loop at 50% of its 174,642 production calls.

87,333 in-loop calls. The function Go runs most inside loops.

Open this one
loops
87,333in-loop calls

The function Go runs most inside loops

encoding/json.Unmarshal sits inside a loop at 50% of its 174,642 production calls.

encoding/json.Unmarshal

loops
66functions

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 66 of the 8,901 ranked functions.

loops
62%of its calls loop

The busy function that almost never leaves a loop

Among functions with real volume, time.Sleep runs inside a loop more than any other, 62% of its 7,451 production calls.

time.Sleep

breadth
1,691modules call it

The function with the widest reach across the ecosystem

fmt.Sprintf is called from 1,691 of the 2,029 modules in the corpus, roughly 1 in every 1.2.

fmt.Sprintf

breadth
215,125calls from 2 modules

The function one codebase hammers harder than anyone

github.com/Azure/go-autorest/autorest.NewErrorWithError makes 215,125 production calls from just 2 modules, about 107,563 calls per module. High volume, almost no breadth.

github.com/Azure/go-autorest/autorest.NewErrorWithError

breadth
21reach half the corpus

True ubiquity is rare

Only 21 functions are called in at least half of the 2,029 modules in the corpus. Almost everything else is niche.

projects
32of 47 projects

The function nearly every project reaches for first

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

fmt.Errorf

projects
535,636production calls

The heaviest caller of them all

Kubernetes makes 535,636 production calls across 39 modules, more than any other project we mapped.

Kubernetes

projects
10,845production calls

Kubernetes' signature call

Kubernetes leans on k8s.io/kubernetes/test/e2e/framework.ExpectNoError harder than the field does. That is 10,845 production calls from its own modules.

k8s.io/kubernetes/test/e2e/framework.ExpectNoError

projects
6,492production calls

Terraform's signature call

Terraform leans on github.com/aws/aws-sdk-go/aws.String harder than the field does. That is 6,492 production calls from its own modules.

github.com/aws/aws-sdk-go/aws.String

projects
5,316production calls

Kyverno's signature call

Kyverno leans on go.opentelemetry.io/otel/attribute.Key.String harder than the field does. That is 5,316 production calls from its own modules.

go.opentelemetry.io/otel/attribute.Key.String

projects
4,715production calls

KubeVirt's signature call

KubeVirt leans on github.com/onsi/gomega.Expect harder than the field does. That is 4,715 production calls from its own modules.

github.com/onsi/gomega.Expect

interfaces
164,310dispatched calls

Go's busiest interface method

github.com/onsi/gomega/types.Assertion.To is dispatched more than any other interface method, 164,310 calls that could land on any implementation.

github.com/onsi/gomega/types.Assertion.To

interfaces
5%of all calls dispatch

Interfaces are everywhere, but they carry little traffic

Just 5% of the 15,660,970 calls in the corpus go through an interface. Most Go is concrete.

interfaces
986modules use io.Writer

Everyone writes through the same shape

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

io.Writer.Write

cost
~31xthe cost of Sprintf

The priciest hot path in the corpus

Weighted by how often it runs, encoding/json.Unmarshal is the corpus's most expensive hot path, about 36x the per-call cost of fmt.Sprintf, and 50% of its calls run inside a loop.

encoding/json.Unmarshal

cost
1.9 nsper operation

The cheapest call we benchmarked

Of the hot-path functions we benchmarked on darwin/arm64 (Apple Silicon), strconv.FormatBool is the cheapest, about 1.9 nanoseconds per call.

strconv.FormatBool

cost
2%of MustCompile in loops

Go programs compile their patterns once, not in the loop

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

regexp.MustCompile

tests
515,000calls inside tests

The most test-bound function in the corpus

testing.common.Fatalf is called 515,000 times from tests, 98% of all its calls.

testing.common.Fatalf

tests
352,064calls inside tests

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

github.com/stretchr/testify/require.NoError is the most-called third-party function in tests, 352,064 calls, 96% of them in test files.

github.com/stretchr/testify/require.NoError

generated
118,423of its calls generated

Even a workhorse leans on code generators

21% of fmt.Errorf's 555,637 calls are emitted by code generators. The rest are hand-written.

fmt.Errorf

generated
8%of all calls

How much of Go is written by code generators

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

long tail
142production calls

The median Go function is barely called at all

Half of the 8,901 ranked functions are called 142 times or fewer in production. The famous ones are the exception.

long tail
52%of all production calls

A tiny fraction of functions does most of the work

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

long tail
21%from the top 10

Ten functions carry a fifth of everything

Just ten functions account for 21% of all 7,735,387 production calls in the corpus.

long tail
45%of work from the stdlib

The standard library punches far above its weight

The 1,515 standard-library functions are 17% of the catalog but do 45% of all production work.

long tail
0%called at most once

Most catalogued functions are barely used

0% of the 8,901 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.