MCPcopy Create free account
hub / github.com/efectn/go-orm-benchmarks / ReadSlice

Method ReadSlice

bench/gorp.go:98–117  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

96}
97
98func (gorp *Gorp) ReadSlice(b *testing.B) {
99 m := NewModel()
100 for i := 0; i < 100; i++ {
101 err := gorp.conn.Insert(m)
102 if err != nil {
103 helper.SetError(b, gorp.Name(), "ReadSlice", err.Error())
104 }
105 }
106
107 b.ReportAllocs()
108 b.ResetTimer()
109
110 for i := 0; i < b.N; i++ {
111 var ms []*Model
112 _, err := gorp.conn.Select(&ms, "select * from models where id > 0 LIMIT 100")
113 if err != nil {
114 helper.SetError(b, gorp.Name(), "ReadSlice", err.Error())
115 }
116 }
117}

Callers

nothing calls this directly

Calls 6

NameMethod · 0.95
SetErrorFunction · 0.92
NewModelFunction · 0.85
InsertMethod · 0.65
ErrorMethod · 0.65
SelectMethod · 0.45

Tested by

no test coverage detected