比较下了下scanner的性能,似乎性能不是太高,可能类型断言太多了些???需要泛型方法啊。。。。。。

This commit is contained in:
xing 2023-02-21 20:15:39 +08:00
parent 226c98cbd9
commit 56f869c10f

View File

@ -506,3 +506,28 @@ func Test_findScanner(t *testing.T) {
}) })
} }
} }
func BenchmarkScannerXX(b *testing.B) {
for i := 0; i < b.N; i++ {
err := findScanner[options](glob, ctx, func(t options) {
_ = t
//fmt.Println(t)
}, Conditions(Where(SqlBuilder{{"option_id", "<", "100", "int"}})))
if err != nil {
panic(err)
}
}
}
func BenchmarkFindsXX(b *testing.B) {
for i := 0; i < b.N; i++ {
r, err := finds[options](glob, ctx, Conditions(Where(SqlBuilder{{"option_id", "<", "100", "int"}})))
if err != nil {
panic(err)
}
for _, o := range r {
_ = o
//fmt.Println(o)
}
}
}