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 14c33d9
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ jobs:
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
benchmark-data-dir-path: "benchmarks"
alert-threshold: "300%"
fail-on-alert: true
comment-on-alert: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
#summary-always: ${{ github.event_name != 'push' && github.event_name != 'workflow_dispatch' }}
Expand Down
2 changes: 1 addition & 1 deletion badger/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func Benchmark_Badger_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Badger_Delete(b *testing.B) {
func Benchmark_Badger_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

Expand Down
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 14c33d9

Please sign in to comment.