MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / benchTempFile

Function benchTempFile

internal/users/index_test.go:21–30  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

19}
20
21func benchTempFile(b *testing.B) (string, func()) {
22 b.Helper()
23 f, err := os.CreateTemp("", "bench_idx_*.idx")
24 if err != nil {
25 b.Fatal(err)
26 }
27 name := f.Name()
28 f.Close()
29 return name, func() { os.Remove(name) }
30}
31
32func BenchmarkFindByUsername_First(b *testing.B) {
33 filename, cleanup := benchTempFile(b)

Calls 3

CloseMethod · 0.65
NameMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected