MCPcopy Create free account
hub / github.com/goinaction/code / BenchmarkSprintf

Function BenchmarkSprintf

chapter9/listing28/listing28_test.go:14–22  ·  view source on GitHub ↗

BenchmarkSprintf provides performance numbers for the fmt.Sprintf function.

(b *testing.B)

Source from the content-addressed store, hash-verified

12// BenchmarkSprintf provides performance numbers for the
13// fmt.Sprintf function.
14func BenchmarkSprintf(b *testing.B) {
15 number := 10
16
17 b.ResetTimer()
18
19 for i := 0; i < b.N; i++ {
20 fmt.Sprintf("%d", number)
21 }
22}
23
24// BenchmarkFormat provides performance numbers for the
25// strconv.FormatInt function.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected