slices.Contains
standard libraryThe 218th most-called standard-library function by production calls. Called 12,245 times across 460 modules; 4,511 of those run outside tests and generated code.
- prod calls
- 4,511
- non-test, non-generated
- all calls
- 12,245
- total callsites
- modules
- 460
- distinct callers
- in loop
- 36%
- of prod calls
- in tests
- 63%
- 7,718 calls
- resolved
- 100%
- to a known target
resolution mix
How each call resolves
How each call was attributed. Only resolved kinds, where the target function is known, count toward the ranking. Interface dispatch and unresolved receivers are reported separately and never guessed. Read the taxonomy →
- Package function100%A direct call to an exported package function, resolved by type.
estimate
Estimated relative cost
Roughly 0.00× the estimated relative cost of fmt.Sprintf . Benchmarked at 3.93 ns/op × 4,511 production calls, normalized so fmt.Sprintf = 1.0.
This is not dollars and not a verdict. Per-op time depends heavily on inputs (argument sizes, contention, patterns), the benchmark ran on a single machine (darwin/arm64 (Apple Silicon), go1.26.0), and static call counts are not runtime frequency. How this is estimated →
who calls this
Notable callers
Production calls into Contains from notable Go projects. Open one on the map to see what else it hammers.
- Kubernetes 287 6%
- Cilium 114 3%
- Grafana 95 2%
- Tailscale 90 2%
- Gitea 89 2%
where it's called
Callsites in the wild
12 representative callsites of 12,245, prioritizing in-loop and non-test usage. We link to source, never display it.
- in loop
-
charm.land/catwalk @v0.51.13
cmd/chutes/main.go:98
in loop -
fang/v2 @v2.0.1
help.go:316
in loop -
charm.land/fantasy @v0.40.0
schema/schema.go:146
in loop - in loop
- in loop
-
miekg/dns @v0.6.90
cmd/atomdns/handlers/acl/rules.go:53
in loop -
readeck/go-readability/v2 @v2.1.2
parser.go:201
in loop - in loop
- in loop
- in loop
-
docker/cli @v29.7.1+incompatible
in loop
top callers
The modules that reach for it
The modules that call Contains most in this snapshot.
- github.com/aws/aws-sdk-go-v2/service/ec27856%
- github.com/aws/aws-sdk-go-v2/service/glue2972%
- github.com/aws/aws-sdk-go-v2/service/iot2722%
- github.com/microsoft/typescript-go2562%
- github.com/kubernetes/kubernetes1791%
siblings
More from slices
The other most-called functions in this package. See all →