aboutsummaryrefslogtreecommitdiff
path: root/benchmark/benchmark_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/benchmark_test.go')
-rw-r--r--benchmark/benchmark_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/benchmark/benchmark_test.go b/benchmark/benchmark_test.go
index ada238e..d18c0cb 100644
--- a/benchmark/benchmark_test.go
+++ b/benchmark/benchmark_test.go
@@ -268,10 +268,12 @@ func BenchmarkInsertAndDelete(b *testing.B) {
// prepare the functions that will be benched
insertAndDeleteWithOblast := func(b *testing.B) {
records := make([]OblastEntry, batchSize)
+ recordsForInsert := make([]*OblastEntry, batchSize)
for idx := range records {
records[idx] = OblastEntry{Message: "hello"}
+ recordsForInsert[idx] = &records[idx]
}
- records = must.Return(store.Insert(db, records...))(b)
+ must.Succeed(b, store.Insert(db, recordsForInsert...))
for _, r := range records {
if r.ID == 0 {
b.Errorf("ID was not filled!")
@@ -388,10 +390,12 @@ func BenchmarkUpdate(b *testing.B) {
// prepare a bunch of records that we can update, in a reproducible way
_ = must.Return(db.Exec(`DELETE FROM entries`))
recordsForOblast := make([]OblastEntry, batchSize)
+ recordsForOblastForInsert := make([]*OblastEntry, batchSize)
for idx := range recordsForOblast {
recordsForOblast[idx] = OblastEntry{Message: "hello"}
+ recordsForOblastForInsert[idx] = &recordsForOblast[idx]
}
- recordsForOblast = must.Return(store.Insert(db, recordsForOblast...))(b)
+ must.Succeed(b, store.Insert(db, recordsForOblastForInsert...))
recordsForGorp := make([]any, batchSize)
for idx, r := range recordsForOblast {
recordsForGorp[idx] = new(GorpEntry(r))