基准测试
This commit is contained in:
parent
a86a576ace
commit
c03c0f06ab
|
|
@ -1,6 +1,8 @@
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"myschools.me/suguo/snippet/sqlite"
|
"myschools.me/suguo/snippet/sqlite"
|
||||||
|
|
@ -38,3 +40,15 @@ func TestSqlite(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkSqlite(b *testing.B) {
|
||||||
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
|
for pb.Next() {
|
||||||
|
m := rand.Intn(100) + 1
|
||||||
|
n := rand.Intn(m)
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
fmt.Sprintf("%d", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue