Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #7

Merged
merged 14 commits into from
Feb 23, 2024
Next Next commit
feat: benchmark
  • Loading branch information
zarttic committed Feb 23, 2024
commit 81d73215f0172d44ee47dbd052e4c4e33317a9ca
31 changes: 31 additions & 0 deletions benchmark/bench_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package benchmark

import (
"bitcask"
"bitcask/utils"
"github.com/stretchr/testify/assert"
"os"
"testing"
)

var db *bitcask.DB

func init() {
cfg := bitcask.DefaultConfig
dir, err := os.MkdirTemp("", "bitcask-bench-test")

Check failure on line 15 in benchmark/bench_test.go

View workflow job for this annotation

GitHub Actions / build

dir declared and not used
if err != nil {
panic(err)
}
db, err = bitcask.Open(cfg)
if err != nil {
panic(err)
}
}
func BenchmarkPut(b *testing.B) {
b.ResetTimer()
b.ResetTimer()
for i := 0; i < b.N; i++ {
err := db.Put(utils.GetTestKey(i), utils.GetTestValue(1024))
assert.Nil(b, err)
}
}
Loading