mirror of https://github.com/hak5/bolt.git
move bench package to bench/cmd/bolt/bench
parent
105fece47a
commit
71e91e24b0
192
tx_test.go
192
tx_test.go
|
@ -267,110 +267,110 @@ func TestTx_OnCommit_Rollback(t *testing.T) {
|
||||||
assert.Equal(t, 0, x)
|
assert.Equal(t, 0, x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkReadSequential_1Concurrency_1Buckets_1Items(b *testing.B) {
|
// func BenchmarkReadSequential_1Concurrency_1Buckets_1Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1, 1)
|
// benchmarkReadSequential(b, 1, 1, 1)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1Concurrency_1Buckets_10Items(b *testing.B) {
|
// func BenchmarkReadSequential_1Concurrency_1Buckets_10Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10, 1)
|
// benchmarkReadSequential(b, 1, 10, 1)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1Concurrency_1Buckets_100Items(b *testing.B) {
|
// func BenchmarkReadSequential_1Concurrency_1Buckets_100Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 100, 1)
|
// benchmarkReadSequential(b, 1, 100, 1)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1Concurrency_1Buckets_1000Items(b *testing.B) {
|
// func BenchmarkReadSequential_1Concurrency_1Buckets_1000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1000, 1)
|
// benchmarkReadSequential(b, 1, 1000, 1)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1Concurrency_1Buckets_10000Items(b *testing.B) {
|
// func BenchmarkReadSequential_1Concurrency_1Buckets_10000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10000, 1)
|
// benchmarkReadSequential(b, 1, 10000, 1)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func BenchmarkReadSequential_10Concurrency_1Buckets_1Items(b *testing.B) {
|
// func BenchmarkReadSequential_10Concurrency_1Buckets_1Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1, 10)
|
// benchmarkReadSequential(b, 1, 1, 10)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10Concurrency_1Buckets_10Items(b *testing.B) {
|
// func BenchmarkReadSequential_10Concurrency_1Buckets_10Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10, 10)
|
// benchmarkReadSequential(b, 1, 10, 10)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10Concurrency_1Buckets_100Items(b *testing.B) {
|
// func BenchmarkReadSequential_10Concurrency_1Buckets_100Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 100, 10)
|
// benchmarkReadSequential(b, 1, 100, 10)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10Concurrency_1Buckets_1000Items(b *testing.B) {
|
// func BenchmarkReadSequential_10Concurrency_1Buckets_1000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1000, 10)
|
// benchmarkReadSequential(b, 1, 1000, 10)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10Concurrency_1Buckets_10000Items(b *testing.B) {
|
// func BenchmarkReadSequential_10Concurrency_1Buckets_10000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10000, 10)
|
// benchmarkReadSequential(b, 1, 10000, 10)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func BenchmarkReadSequential_100Concurrency_1Buckets_1Items(b *testing.B) {
|
// func BenchmarkReadSequential_100Concurrency_1Buckets_1Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1, 100)
|
// benchmarkReadSequential(b, 1, 1, 100)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_100Concurrency_1Buckets_10Items(b *testing.B) {
|
// func BenchmarkReadSequential_100Concurrency_1Buckets_10Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10, 100)
|
// benchmarkReadSequential(b, 1, 10, 100)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_100Concurrency_1Buckets_100Items(b *testing.B) {
|
// func BenchmarkReadSequential_100Concurrency_1Buckets_100Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 100, 100)
|
// benchmarkReadSequential(b, 1, 100, 100)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_100Concurrency_1Buckets_1000Items(b *testing.B) {
|
// func BenchmarkReadSequential_100Concurrency_1Buckets_1000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1000, 100)
|
// benchmarkReadSequential(b, 1, 1000, 100)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_100Concurrency_1Buckets_10000Items(b *testing.B) {
|
// func BenchmarkReadSequential_100Concurrency_1Buckets_10000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10000, 100)
|
// benchmarkReadSequential(b, 1, 10000, 100)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func BenchmarkReadSequential_1000Concurrency_1Buckets_1Items(b *testing.B) {
|
// func BenchmarkReadSequential_1000Concurrency_1Buckets_1Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1, 1000)
|
// benchmarkReadSequential(b, 1, 1, 1000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1000Concurrency_1Buckets_10Items(b *testing.B) {
|
// func BenchmarkReadSequential_1000Concurrency_1Buckets_10Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10, 1000)
|
// benchmarkReadSequential(b, 1, 10, 1000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1000Concurrency_1Buckets_100Items(b *testing.B) {
|
// func BenchmarkReadSequential_1000Concurrency_1Buckets_100Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 100, 1000)
|
// benchmarkReadSequential(b, 1, 100, 1000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1000Concurrency_1Buckets_1000Items(b *testing.B) {
|
// func BenchmarkReadSequential_1000Concurrency_1Buckets_1000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1000, 1000)
|
// benchmarkReadSequential(b, 1, 1000, 1000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_1000Concurrency_1Buckets_10000Items(b *testing.B) {
|
// func BenchmarkReadSequential_1000Concurrency_1Buckets_10000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10000, 1000)
|
// benchmarkReadSequential(b, 1, 10000, 1000)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func BenchmarkReadSequential_10000Concurrency_1Buckets_1Items(b *testing.B) {
|
// func BenchmarkReadSequential_10000Concurrency_1Buckets_1Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1, 10000)
|
// benchmarkReadSequential(b, 1, 1, 10000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10000Concurrency_1Buckets_10Items(b *testing.B) {
|
// func BenchmarkReadSequential_10000Concurrency_1Buckets_10Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10, 10000)
|
// benchmarkReadSequential(b, 1, 10, 10000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10000Concurrency_1Buckets_100Items(b *testing.B) {
|
// func BenchmarkReadSequential_10000Concurrency_1Buckets_100Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 100, 10000)
|
// benchmarkReadSequential(b, 1, 100, 10000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10000Concurrency_1Buckets_1000Items(b *testing.B) {
|
// func BenchmarkReadSequential_10000Concurrency_1Buckets_1000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 1000, 10000)
|
// benchmarkReadSequential(b, 1, 1000, 10000)
|
||||||
}
|
// }
|
||||||
func BenchmarkReadSequential_10000Concurrency_1Buckets_10000Items(b *testing.B) {
|
// func BenchmarkReadSequential_10000Concurrency_1Buckets_10000Items(b *testing.B) {
|
||||||
benchmarkReadSequential(b, 1, 10000, 10000)
|
// benchmarkReadSequential(b, 1, 10000, 10000)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func benchmark(b *testing.B, readWriteMode, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
|
// func benchmark(b *testing.B, readWriteMode, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
|
||||||
withOpenDB(func(db *DB, path string) {
|
// withOpenDB(func(db *DB, path string) {
|
||||||
if err := bench.GenerateDB(db, numBuckets, numItemsPerBucket); err != nil {
|
// if err := bench.GenerateDB(db, numBuckets, numItemsPerBucket); err != nil {
|
||||||
b.Fatal(err)
|
// b.Fatal(err)
|
||||||
}
|
// }
|
||||||
bench.New(db, &bench.Config{
|
// bench.New(db, &bench.Config{
|
||||||
ReadWriteMode: readWriteMode,
|
// ReadWriteMode: readWriteMode,
|
||||||
TraversalPattern: traversalPattern,
|
// TraversalPattern: traversalPattern,
|
||||||
Parallelism: parallelism,
|
// Parallelism: parallelism,
|
||||||
}).Run(b)
|
// }).Run(b)
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
func benchmarkRead(b *testing.B, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
|
// func benchmarkRead(b *testing.B, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
|
||||||
benchmark(b, bench.BenchReadMode, traversalPattern, numBuckets, numItemsPerBucket, parallelism)
|
// benchmark(b, bench.BenchReadMode, traversalPattern, numBuckets, numItemsPerBucket, parallelism)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func benchmarkReadSequential(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
|
// func benchmarkReadSequential(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
|
||||||
benchmark(b, bench.BenchReadMode, bench.BenchSequentialTraversal, numBuckets, numItemsPerBucket, parallelism)
|
// benchmark(b, bench.BenchReadMode, bench.BenchSequentialTraversal, numBuckets, numItemsPerBucket, parallelism)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func benchmarkReadRandom(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
|
// func benchmarkReadRandom(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
|
||||||
benchmark(b, bench.BenchReadMode, bench.BenchRandomTraversal, numBuckets, numItemsPerBucket, parallelism)
|
// benchmark(b, bench.BenchReadMode, bench.BenchRandomTraversal, numBuckets, numItemsPerBucket, parallelism)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Benchmark the performance iterating over a cursor.
|
// Benchmark the performance iterating over a cursor.
|
||||||
func BenchmarkTxCursor1(b *testing.B) { benchmarkTxCursor(b, 1) }
|
func BenchmarkTxCursor1(b *testing.B) { benchmarkTxCursor(b, 1) }
|
||||||
|
|
Loading…
Reference in New Issue