add benchmarks for all storages

This commit is contained in:
Muhammed Efe Cetin
2023-09-15 00:02:13 +03:00
parent f8afad537f
commit 68d59280d8
20 changed files with 864 additions and 17 deletions

View File

@@ -173,3 +173,43 @@ func Test_MSSQL_Close(t *testing.T) {
func Test_MSSQL_Conn(t *testing.T) {
require.True(t, testStore.Conn() != nil)
}
func Benchmark_MSSQL_Set(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
var err error
for i := 0; i < b.N; i++ {
err = testStore.Set("john", []byte("doe"), 0)
}
require.NoError(b, err)
}
func Benchmark_MSSQL_Get(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err = testStore.Get("john")
}
require.NoError(b, err)
}
func Benchmark_MSSQL_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
err = testStore.Delete("john")
}
require.NoError(b, err)
}