func BenchmarkTxn_PutReserve_writemap(b *testing.B) {
	initRandSource(b)
	env := setupFlags(b, WriteMap)
	defer clean(env, b)

	dbi := openBenchDBI(b, env)

	rc := newRandSourceCursor()
	ps, err := populateBenchmarkDB(env, dbi, &rc)
	if err != nil {
		b.Errorf("populate db: %v", err)
		return
	}

	err = env.Update(func(txn *Txn) (err error) {
		b.ResetTimer()
		defer b.StopTimer()
		for i := 0; i < b.N; i++ {
			k := ps[rand.Intn(len(ps)/2)*2]
			v := makeBenchDBVal(&rc)
			buf, err := txn.PutReserve(dbi, k, len(v), 0)
			if err != nil {
				return err
			}
			copy(buf, v)
		}
		return nil
	})
	if err != nil {
		b.Error(err)
		return
	}
}
// repeatedly put (overwrite) keys using the PutReserve method on an
// environment with WriteMap.
repeatedly put (overwrite) keys using the PutReserve method on an
environment with WriteMap.
// repeatedly put ( overwrite ) keys using the PutReserve method on an // environment with WriteMap .
func BenchmarkTxn_PutReserve_writemap(b *testing.B) {
	initRandSource(b)
	env := setupFlags(b, WriteMap)
	defer clean(env, b)
	dbi := openBenchDBI(b, env)
	rc := newRandSourceCursor()
	ps, err := populateBenchmarkDB(env, dbi, &rc)
	if err != nil {
		b.Errorf("populate db: %v", err)
		return
	}
	err = env.Update(func(txn *Txn) (err error) {
		b.ResetTimer()
		defer b.StopTimer()
		for i := 0; i < b.N; i++ {
			k := ps[rand.Intn(len(ps)/2)*2]
			v := makeBenchDBVal(&rc)
			buf, err := txn.PutReserve(dbi, k, len(v), 0)
			if err != nil {
				return err
			}
			copy(buf, v)
		}
		return nil
	})
	if err != nil {
		b.Error(err)
		return
	}
}
func BenchmarkTxn_PutReserve_writemap ( b * testing . B ) { initRandSource ( b ) env := setupFlags ( b , WriteMap ) defer clean ( env , b ) dbi := openBenchDBI ( b , env ) rc := newRandSourceCursor ( ) ps , err := populateBenchmarkDB ( env , dbi , & rc ) if err != nil { b . Errorf ( " " , err ) return } err = env . Update ( func ( txn * Txn ) ( err error ) { b . ResetTimer ( ) defer b . StopTimer ( ) for i := 0 ; i < b . N ; i ++ { k := ps [ rand . Intn ( len ( ps ) / 2 ) * 2 ] v := makeBenchDBVal ( & rc ) buf , err := txn . PutReserve ( dbi , k , len ( v ) , 0 ) if err != nil { return err } copy ( buf , v ) } return nil } ) if err != nil { b . Error ( err ) return } }
repeatedly put (overwrite) keys using the PutReserve method on an
environment with WriteMap.
repeatedly put ( overwrite ) keys using the PutReserve method on an environment with WriteMap .