Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed Sep 15, 2023
1 parent 6f58085 commit a15ce94
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
2 changes: 1 addition & 1 deletion bbolt/bbolt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func Benchmark_Bbolt_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Bbolt_Delete(b *testing.B) {
func Benchmark_Bbolt_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

Expand Down
29 changes: 0 additions & 29 deletions memory/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"
"time"

"github.com/gofiber/utils/v2"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -120,34 +119,6 @@ func Test_Storage_Memory_Conn(t *testing.T) {
require.True(t, testStore.Conn() != nil)
}

// go test -v -run=^$ -bench=Benchmark_Storage_Memory -benchmem -count=4
func Benchmark_Storage_Memory(b *testing.B) {
keyLength := 1000
keys := make([]string, keyLength)
for i := 0; i < keyLength; i++ {
keys[i] = utils.UUID()
}
value := []byte("joe")

ttl := 2 * time.Second
b.Run("fiber_memory", func(b *testing.B) {
d := New()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for _, key := range keys {
d.Set(key, value, ttl)
}
for _, key := range keys {
_, _ = d.Get(key)
}
for _, key := range keys {
d.Delete(key)
}
}
})
}

func Benchmark_Memory_Set(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
Expand Down
2 changes: 1 addition & 1 deletion sqlite3/sqlite3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func Benchmark_SQLite3_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_SQLite3_Delete(b *testing.B) {
func Benchmark_SQLite3_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

Expand Down

0 comments on commit a15ce94

Please sign in to comment.