move bench package to bench/cmd/bolt/bench

master
Steven Normore 2014-04-14 16:25:04 +00:00 committed by Ben Johnson
parent 105fece47a
commit 71e91e24b0
4 changed files with 96 additions and 96 deletions

View File

@ -267,110 +267,110 @@ func TestTx_OnCommit_Rollback(t *testing.T) {
assert.Equal(t, 0, x)
}
func BenchmarkReadSequential_1Concurrency_1Buckets_1Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1, 1)
}
func BenchmarkReadSequential_1Concurrency_1Buckets_10Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10, 1)
}
func BenchmarkReadSequential_1Concurrency_1Buckets_100Items(b *testing.B) {
benchmarkReadSequential(b, 1, 100, 1)
}
func BenchmarkReadSequential_1Concurrency_1Buckets_1000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1000, 1)
}
func BenchmarkReadSequential_1Concurrency_1Buckets_10000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10000, 1)
}
// func BenchmarkReadSequential_1Concurrency_1Buckets_1Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1, 1)
// }
// func BenchmarkReadSequential_1Concurrency_1Buckets_10Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10, 1)
// }
// func BenchmarkReadSequential_1Concurrency_1Buckets_100Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 100, 1)
// }
// func BenchmarkReadSequential_1Concurrency_1Buckets_1000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1000, 1)
// }
// func BenchmarkReadSequential_1Concurrency_1Buckets_10000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10000, 1)
// }
func BenchmarkReadSequential_10Concurrency_1Buckets_1Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1, 10)
}
func BenchmarkReadSequential_10Concurrency_1Buckets_10Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10, 10)
}
func BenchmarkReadSequential_10Concurrency_1Buckets_100Items(b *testing.B) {
benchmarkReadSequential(b, 1, 100, 10)
}
func BenchmarkReadSequential_10Concurrency_1Buckets_1000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1000, 10)
}
func BenchmarkReadSequential_10Concurrency_1Buckets_10000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10000, 10)
}
// func BenchmarkReadSequential_10Concurrency_1Buckets_1Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1, 10)
// }
// func BenchmarkReadSequential_10Concurrency_1Buckets_10Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10, 10)
// }
// func BenchmarkReadSequential_10Concurrency_1Buckets_100Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 100, 10)
// }
// func BenchmarkReadSequential_10Concurrency_1Buckets_1000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1000, 10)
// }
// func BenchmarkReadSequential_10Concurrency_1Buckets_10000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10000, 10)
// }
func BenchmarkReadSequential_100Concurrency_1Buckets_1Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1, 100)
}
func BenchmarkReadSequential_100Concurrency_1Buckets_10Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10, 100)
}
func BenchmarkReadSequential_100Concurrency_1Buckets_100Items(b *testing.B) {
benchmarkReadSequential(b, 1, 100, 100)
}
func BenchmarkReadSequential_100Concurrency_1Buckets_1000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1000, 100)
}
func BenchmarkReadSequential_100Concurrency_1Buckets_10000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10000, 100)
}
// func BenchmarkReadSequential_100Concurrency_1Buckets_1Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1, 100)
// }
// func BenchmarkReadSequential_100Concurrency_1Buckets_10Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10, 100)
// }
// func BenchmarkReadSequential_100Concurrency_1Buckets_100Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 100, 100)
// }
// func BenchmarkReadSequential_100Concurrency_1Buckets_1000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1000, 100)
// }
// func BenchmarkReadSequential_100Concurrency_1Buckets_10000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10000, 100)
// }
func BenchmarkReadSequential_1000Concurrency_1Buckets_1Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1, 1000)
}
func BenchmarkReadSequential_1000Concurrency_1Buckets_10Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10, 1000)
}
func BenchmarkReadSequential_1000Concurrency_1Buckets_100Items(b *testing.B) {
benchmarkReadSequential(b, 1, 100, 1000)
}
func BenchmarkReadSequential_1000Concurrency_1Buckets_1000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1000, 1000)
}
func BenchmarkReadSequential_1000Concurrency_1Buckets_10000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10000, 1000)
}
// func BenchmarkReadSequential_1000Concurrency_1Buckets_1Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1, 1000)
// }
// func BenchmarkReadSequential_1000Concurrency_1Buckets_10Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10, 1000)
// }
// func BenchmarkReadSequential_1000Concurrency_1Buckets_100Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 100, 1000)
// }
// func BenchmarkReadSequential_1000Concurrency_1Buckets_1000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1000, 1000)
// }
// func BenchmarkReadSequential_1000Concurrency_1Buckets_10000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10000, 1000)
// }
func BenchmarkReadSequential_10000Concurrency_1Buckets_1Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1, 10000)
}
func BenchmarkReadSequential_10000Concurrency_1Buckets_10Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10, 10000)
}
func BenchmarkReadSequential_10000Concurrency_1Buckets_100Items(b *testing.B) {
benchmarkReadSequential(b, 1, 100, 10000)
}
func BenchmarkReadSequential_10000Concurrency_1Buckets_1000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 1000, 10000)
}
func BenchmarkReadSequential_10000Concurrency_1Buckets_10000Items(b *testing.B) {
benchmarkReadSequential(b, 1, 10000, 10000)
}
// func BenchmarkReadSequential_10000Concurrency_1Buckets_1Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1, 10000)
// }
// func BenchmarkReadSequential_10000Concurrency_1Buckets_10Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10, 10000)
// }
// func BenchmarkReadSequential_10000Concurrency_1Buckets_100Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 100, 10000)
// }
// func BenchmarkReadSequential_10000Concurrency_1Buckets_1000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 1000, 10000)
// }
// func BenchmarkReadSequential_10000Concurrency_1Buckets_10000Items(b *testing.B) {
// benchmarkReadSequential(b, 1, 10000, 10000)
// }
func benchmark(b *testing.B, readWriteMode, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
withOpenDB(func(db *DB, path string) {
if err := bench.GenerateDB(db, numBuckets, numItemsPerBucket); err != nil {
b.Fatal(err)
}
bench.New(db, &bench.Config{
ReadWriteMode: readWriteMode,
TraversalPattern: traversalPattern,
Parallelism: parallelism,
}).Run(b)
})
}
// func benchmark(b *testing.B, readWriteMode, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
// withOpenDB(func(db *DB, path string) {
// if err := bench.GenerateDB(db, numBuckets, numItemsPerBucket); err != nil {
// b.Fatal(err)
// }
// bench.New(db, &bench.Config{
// ReadWriteMode: readWriteMode,
// TraversalPattern: traversalPattern,
// Parallelism: parallelism,
// }).Run(b)
// })
// }
func benchmarkRead(b *testing.B, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
benchmark(b, bench.BenchReadMode, traversalPattern, numBuckets, numItemsPerBucket, parallelism)
}
// func benchmarkRead(b *testing.B, traversalPattern string, numBuckets, numItemsPerBucket, parallelism int) {
// benchmark(b, bench.BenchReadMode, traversalPattern, numBuckets, numItemsPerBucket, parallelism)
// }
func benchmarkReadSequential(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
benchmark(b, bench.BenchReadMode, bench.BenchSequentialTraversal, numBuckets, numItemsPerBucket, parallelism)
}
// func benchmarkReadSequential(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
// benchmark(b, bench.BenchReadMode, bench.BenchSequentialTraversal, numBuckets, numItemsPerBucket, parallelism)
// }
func benchmarkReadRandom(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
benchmark(b, bench.BenchReadMode, bench.BenchRandomTraversal, numBuckets, numItemsPerBucket, parallelism)
}
// func benchmarkReadRandom(b *testing.B, numBuckets, numItemsPerBucket, parallelism int) {
// benchmark(b, bench.BenchReadMode, bench.BenchRandomTraversal, numBuckets, numItemsPerBucket, parallelism)
// }
// Benchmark the performance iterating over a cursor.
func BenchmarkTxCursor1(b *testing.B) { benchmarkTxCursor(b, 1) }