INNER CODE UNIT · Go
BenchmarkFileStoreRead
256dpi/lungo · bench_test.go:115
func BenchmarkFileStoreRead(b *testing.B) {
_ = os.Remove("./bench.bson")
client, engine, err := Open(nil, Options{
Store: NewFileStore("./bench.bson", 0666),
})
if err != nil {
panic(err)
}
defer engine.Close()
coll := client.Database("foo").Collection("foo")
for i := 0; i < 100; i++ {
_, err = coll.InsertOne(nil, bson.M{
"n": i,
})