You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: storage_bench_test.go
    path of file: ./repos/cosmos-sdk/store/storage
    
    the code of the file until where you have to start completion: //go:build rocksdb
// +build rocksdb

package storage_test

import (
	"bytes"
	"fmt"
	"math/rand"
	"sort"
	"testing"

	"github.com/stretchr/testify/require"

	"cosmossdk.io/log"
	"cosmossdk.io/store/v2"
	"cosmossdk.io/store/v2/storage"
	"cosmossdk.io/store/v2/storage/pebbledb"
	"cosmossdk.io/store/v2/storage/rocksdb"
	"cosmossdk.io/store/v2/storage/sqlite"
)

const (
	storeKey1 = "store1"
)

var (
	backends = map[string]func(dataDir string) (store.VersionedDatabase, error){
		"rocksdb_versiondb_opts": func(dataDir string) (store.VersionedDatabase, error) {
			db, err := rocksdb.New(dataDir)
			return storage.NewStorageStore(db, nil, log.NewNopLogger()), err
		},
		"pebbledb_default_opts": func(dataDir string) (store.VersionedDatabase, error) {
			db, err := pebbledb.New(dataDir)
			if err == nil && db != nil {
				db.SetSync(false)
			}

			return storage.NewStorageStore(db, nil
    
func BenchmarkGet(b *testing.B) {
	numKeyVals := 1_000_000
	keys := make([][]byte, numKeyVals)
	vals := make([][]byte, numKeyVals)
	for i := 0; i < numKeyVals; i++ {
		key := make([]byte, 128)
		val := make([]byte, 128)

		_, err := rng.Read(key)
		require.NoError(b, err)
		_, err = rng.Read(val)
		require.NoError(b, err)

		keys[i] = key
		vals[i] = val
	}

	for ty, fn := range backends {
		db, err := fn(b.TempDir())
		require.NoError(b, err)
		defer func() {
			_ = db.Close()
		}()

		cs := store.NewChangesetWithPairs(map[string]store.KVPairs{storeKey1: {}})
		for i := 0; i < numKeyVals; i++ {
			cs.AddKVPair(storeKey1, store.KVPair{Key: keys[i], Value: vals[i]})
		}

		require.NoError(b, db.ApplyChangeset(1, cs))

		b.Run(fmt.Sprintf("backend_%s", ty), func(b *testing.B) {
			b.ResetTimer()

			for i := 0; i < b.N; i++ {
				b.StopTimer()
				key := keys[rng.Intn(len(keys))]

				b.StartTimer()
				_, err = db.Get(storeKey1, 1, key)
				require.NoError(b, err)
			}
		})
	}
}