Skip to content
callcount

insights

What the call data turns up

Every count on this page is derived from the snapshot: 9,201 functions, 29.36M 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,194in-loop calls

The function Go runs most inside loops

encoding/json.Unmarshal sits inside a loop at 51% of its 172,393 production calls.

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

Open this one
loops
87,194in-loop calls

The function Go runs most inside loops

encoding/json.Unmarshal sits inside a loop at 51% of its 172,393 production calls.

encoding/json.Unmarshal

loops
67functions

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 67 of the 9,201 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,422 production calls.

time.Sleep

breadth
1,689modules call it

The function with the widest reach across the ecosystem

fmt.Sprintf is called from 1,689 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
20reach half the corpus

True ubiquity is rare

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

projects
33of 47 projects

The function nearly every project reaches for first

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

fmt.Errorf

projects
518,892production calls

The heaviest caller of them all

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

Kubernetes

projects
10,641production calls

Kubernetes' signature call

Kubernetes leans on k8s.io/kubernetes/test/e2e/framework.ExpectNoError harder than the field does. That is 10,641 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,202production calls

Kyverno's signature call

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

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

projects
4,526production calls

KubeVirt's signature call

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

github.com/onsi/gomega.Expect

interfaces
154,901dispatched calls

Go's busiest interface method

github.com/onsi/gomega/types.Assertion.To is dispatched more than any other interface method, 154,901 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 14,855,999 calls in the corpus go through an interface. Most Go is concrete.

interfaces
984modules use io.Writer

Everyone writes through the same shape

984 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 51% 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
448,315calls inside tests

The most test-bound function in the corpus

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

testing.common.Fatalf

tests
298,363calls 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, 298,363 calls, 96% of them in test files.

github.com/stretchr/testify/require.NoError

generated
137,840of its calls generated

Even a workhorse leans on code generators

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

fmt.Errorf

generated
9%of all calls

How much of Go is written by code generators

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

long tail
133production calls

The median Go function is barely called at all

Half of the 9,201 ranked functions are called 133 times or fewer in production. The famous ones are the exception.

long tail
53%of all production calls

A tiny fraction of functions does most of the work

The busiest 1% of functions, 92 of them, account for 53% 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,550,935 production calls in the corpus.

long tail
44%of work from the stdlib

The standard library punches far above its weight

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

long tail
0%called at most once

Most catalogued functions are barely used

0% of the 9,201 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.