Skip to content
callcount

insights

What the call data turns up

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

The function Go runs most inside loops

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

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

Open this one
loops
87,161in-loop calls

The function Go runs most inside loops

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

encoding/json.Unmarshal

loops
65functions

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 65 of the 9,220 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,421 production calls.

time.Sleep

breadth
1,690modules call it

The function with the widest reach across the ecosystem

fmt.Sprintf is called from 1,690 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
515,398production calls

The heaviest caller of them all

Kubernetes makes 515,398 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
3,722production calls

TiDB's signature call

TiDB leans on github.com/juju/errors.Trace harder than the field does. That is 3,722 production calls from its own modules.

github.com/juju/errors.Trace

projects
3,611production calls

HashiCorp's signature call

HashiCorp leans on github.com/hashicorp/boundary/internal/errors.New harder than the field does. That is 3,611 production calls from its own modules.

github.com/hashicorp/boundary/internal/errors.New

interfaces
58,482dispatched calls

Go's busiest interface method

io.Closer.Close is dispatched more than any other interface method, 58,482 calls that could land on any implementation.

io.Closer.Close

interfaces
4%of all calls dispatch

Interfaces are everywhere, but they carry little traffic

Just 4% of the 13,841,342 calls in the corpus go through an interface. Most Go is concrete.

interfaces
979modules use io.Writer

Everyone writes through the same shape

979 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
3%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 3% of its calls sit inside a loop. The expensive part stays out of the hot path.

regexp.MustCompile

tests
443,834calls inside tests

The most test-bound function in the corpus

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

testing.common.Fatalf

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

github.com/stretchr/testify/require.NoError

generated
155,326of its calls generated

Even a workhorse leans on code generators

27% of fmt.Errorf's 570,823 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
130production calls

The median Go function is barely called at all

Half of the 9,220 ranked functions are called 130 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,434,386 production calls in the corpus.

long tail
45%of work from the stdlib

The standard library punches far above its weight

The 1,525 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 9,220 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.