Skip to content

Commit

Permalink
update delete benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed Sep 15, 2023
1 parent 36dd674 commit db1dd2b
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 93 deletions.
7 changes: 3 additions & 4 deletions arangodb/arangodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,13 @@ func Benchmark_ArangoDB_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_ArangoDB_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_ArangoDB_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions azureblob/azureblob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,13 @@ func Benchmark_AzureBlob_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_AzureBlob_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_AzureBlob_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
5 changes: 2 additions & 3 deletions badger/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,12 @@ func Benchmark_Badger_Get(b *testing.B) {
}

func Benchmark_Badger_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
5 changes: 2 additions & 3 deletions bbolt/bbolt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,12 @@ func Benchmark_Bbolt_Get(b *testing.B) {
}

func Benchmark_Bbolt_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions coherence/coherence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,13 @@ func Benchmark_Coherence_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Coherence_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Coherence_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions couchbase/couchbase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,15 @@ func Benchmark_Couchbase_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Couchbase_Delete(b *testing.B) {
func Benchmark_Couchbase_SetAndDelete(b *testing.B) {
testStore := newTestStore(b)

err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
39 changes: 39 additions & 0 deletions dynamodb/dynamodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,42 @@ func Test_DynamoDB_Close(t *testing.T) {
func Test_DynamoDB_Conn(t *testing.T) {
require.True(t, testStore.Conn() != nil)
}

func Benchmark_DynamoDB_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_DynamoDB_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_DynamoDB_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

require.NoError(b, err)
}
7 changes: 3 additions & 4 deletions etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,13 @@ func Benchmark_Etcd_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Etcd_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Etcd_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions memcache/memcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,13 @@ func Benchmark_Memcache_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Memcache_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Memcache_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions memory/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,13 @@ func Benchmark_Memory_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Memory_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Memory_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions minio/minio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,13 @@ func Benchmark_Minio_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Minio_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Minio_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions mongodb/mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,13 @@ func Benchmark_MongoDB_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_MongoDB_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_MongoDB_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions mssql/mssql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,13 @@ func Benchmark_MSSQL_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_MSSQL_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_MSSQL_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,13 @@ func Benchmark_MYSQL_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_MYSQL_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_MYSQL_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions pebble/pebble_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,13 @@ func Benchmark_Pebble_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Pebble_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Pebble_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
7 changes: 3 additions & 4 deletions postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,13 @@ func Benchmark_Postgres_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Postgres_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Postgres_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
25 changes: 11 additions & 14 deletions redis/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@ func Test_Redis_Initalize_WithURL_TLS(t *testing.T) {
return
}
tlsCfg := &tls.Config{
MinVersion: tls.VersionTLS12,
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
PreferServerCipherSuites: true,
InsecureSkipVerify: true,
Certificates: []tls.Certificate{cer},
MinVersion: tls.VersionTLS12,
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
InsecureSkipVerify: true,
Certificates: []tls.Certificate{cer},
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
Expand Down Expand Up @@ -195,11 +194,10 @@ func Test_Redis_Initalize_WithURL_TLS_Verify(t *testing.T) {
return
}
tlsCfg := &tls.Config{
MinVersion: tls.VersionTLS12,
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
PreferServerCipherSuites: true,
InsecureSkipVerify: false,
Certificates: []tls.Certificate{cer},
MinVersion: tls.VersionTLS12,
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
InsecureSkipVerify: false,
Certificates: []tls.Certificate{cer},
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
Expand Down Expand Up @@ -441,14 +439,13 @@ func Benchmark_Redis_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Redis_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Redis_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
9 changes: 4 additions & 5 deletions ristretto/ristretto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Test_Ristretto_Set_Expiration(t *testing.T) {
err := testStore.Set(key, val, exp)
require.NoError(t, err)

testStore.Reset()
require.NoError(t, testStore.Reset())
}

func Test_Ristretto_Get_Expired(t *testing.T) {
Expand Down Expand Up @@ -190,14 +190,13 @@ func Benchmark_Ristretto_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Ristretto_Delete(b *testing.B) {
err := testStore.Set("john", []byte("doe"), 0)
require.NoError(b, err)

func Benchmark_Ristretto_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

var err error
for i := 0; i < b.N; i++ {
_ = testStore.Set("john", []byte("doe"), 0)
err = testStore.Delete("john")
}

Expand Down
Loading

0 comments on commit db1dd2b

Please sign in to comment.