summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorleveldb Team <no-reply@google.com>2023-03-30 07:12:55 +0000
committerAustin Sullivan <asully@chromium.org>2023-04-20 18:08:55 +0000
commitc61238dcf39bdcfb6ef27abbda35b4cbf42b9002 (patch)
tree445a68645c77033ce7d72e9c5116fa4e933108fe /benchmarks
parent77d66aaf3edd6db0f1bfb4308fdc68c62fcc7bf6 (diff)
downloadleveldb-c61238dcf39bdcfb6ef27abbda35b4cbf42b9002.tar.gz
Support Zstd compression level in Leveldb
PiperOrigin-RevId: 520556840
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/db_bench.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/benchmarks/db_bench.cc b/benchmarks/db_bench.cc
index db866f5..8e3f4e7 100644
--- a/benchmarks/db_bench.cc
+++ b/benchmarks/db_bench.cc
@@ -126,6 +126,9 @@ static bool FLAGS_compression = true;
// Use the db with the following name.
static const char* FLAGS_db = nullptr;
+// ZSTD compression level to try out
+static int FLAGS_zstd_compression_level = 1;
+
namespace leveldb {
namespace {
@@ -779,11 +782,21 @@ class Benchmark {
}
void ZstdCompress(ThreadState* thread) {
- Compress(thread, "zstd", &port::Zstd_Compress);
+ Compress(thread, "zstd",
+ [](const char* input, size_t length, std::string* output) {
+ return port::Zstd_Compress(FLAGS_zstd_compression_level, input,
+ length, output);
+ });
}
void ZstdUncompress(ThreadState* thread) {
- Uncompress(thread, "zstd", &port::Zstd_Compress, &port::Zstd_Uncompress);
+ Uncompress(
+ thread, "zstd",
+ [](const char* input, size_t length, std::string* output) {
+ return port::Zstd_Compress(FLAGS_zstd_compression_level, input,
+ length, output);
+ },
+ &port::Zstd_Uncompress);
}
void Open() {