Skip to content

Commit

Permalink
removed benchmarking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelightning committed Jun 21, 2024
1 parent e6fdeda commit 2716b90
Showing 1 changed file with 0 additions and 81 deletions.
81 changes: 0 additions & 81 deletions txn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2236,84 +2236,3 @@ func assertNilError(t *testing.T, err error) {
t.Fatalf("expected nil error, got %v", err)
}
}

func BenchmarkTxnInsert(b *testing.B) {
db := testDBB(b)
txn := db.Txn(true)

obj := testObj()
for i := 0; i < b.N; i++ {
err := txn.Insert("main", obj)
if err != nil {
b.Fatalf("err: %v", err)
}

raw, err := txn.First("main", "id", obj.ID)
if err != nil {
b.Fatalf("err: %v", err)
}

if raw != obj {
b.Fatalf("bad: %#v %#v", raw, obj)
}
}
}

func BenchmarkTxnDelete(b *testing.B) {
db := testDBB(b)
txn := db.Txn(true)

obj := testObjUUID()
for i := 0; i < b.N; i++ {
err := txn.Insert("main", obj)
if err != nil {
b.Fatalf("err: %v", err)
}

raw, err := txn.First("main", "id", obj.ID)
if err != nil {
b.Fatalf("err: %v", err)
}

if raw != obj {
b.Fatalf("bad: %#v %#v", raw, obj)
}
err = txn.Delete("main", obj)
}
}

func BenchmarkTxnDeletePrefix(b *testing.B) {
db := testDBB(b)
txn := db.Txn(true)

obj := testObjUUID()
for i := 0; i < b.N; i++ {
err := txn.Insert("main", obj)
if err != nil {
b.Fatalf("err: %v", err)
}

raw, err := txn.First("main", "id", obj.ID)
if err != nil {
b.Fatalf("err: %v", err)
}

if raw != obj {
b.Fatalf("bad: %#v %#v", raw, obj)
}
_, _ = txn.DeletePrefix("main", "id", "")
}
}

func BenchmarkTxnFirst(b *testing.B) {
db := testDBB(b)
txn := db.Txn(true)

for i := 0; i < b.N; i++ {
obj := testObjUUID()
err := txn.Insert("main", obj)
_, err = txn.First("main", "id", obj)
if err != nil {
}
}
}

0 comments on commit 2716b90

Please sign in to comment.