This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 7e9d7adc8f311c88b2aff673549fe3b8931e69c6 Author: Alexey Serbin <[email protected]> AuthorDate: Thu Mar 6 16:37:04 2025 -0800 [util] use ZBEST_SPEED for zlib::Compress() The only non-test call site for zlib::CompressLevel() is in embedded web server, where ZBEST_SPEED compression level is used. From the other side, tracing path handlers is the only non-test call site place where zlib::Compress() is used. The latter seems to benefit the same way as the former if switching from Z_DEFAULT_COMPRESSION to ZBEST_SPEED compression level in [1]. In other words, it makes sense to switch zlib::Compress() from Z_DEFAULT_COMPRESSION to ZBEST_SPEED and use zlib::Compress() everywhere. This patch does exactly so. [1] https://github.com/apache/kudu/commit/9106a3ca8 Change-Id: Ib2541a8785cff776fc9e8a6df23c2f44e77fdc5b Reviewed-on: http://gerrit.cloudera.org:8080/22594 Reviewed-by: Yifan Zhang <[email protected]> Reviewed-by: Abhishek Chennaka <[email protected]> Tested-by: Alexey Serbin <[email protected]> --- src/kudu/server/webserver.cc | 2 +- src/kudu/util/zlib.cc | 2 +- src/kudu/util/zlib.h | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kudu/server/webserver.cc b/src/kudu/server/webserver.cc index 22f4cd1d0..e7d583181 100644 --- a/src/kudu/server/webserver.cc +++ b/src/kudu/server/webserver.cc @@ -791,7 +791,7 @@ void Webserver::SendResponse(struct sq_connection* connection, } ostringstream oss; - Status s = zlib::CompressLevel(uncompressed, 1, &oss); + const auto s = zlib::Compress(uncompressed, &oss); if (PREDICT_TRUE(s.ok())) { resp->output.str(oss.str()); is_compressed = true; diff --git a/src/kudu/util/zlib.cc b/src/kudu/util/zlib.cc index 4d70c29a1..88e1133d0 100644 --- a/src/kudu/util/zlib.cc +++ b/src/kudu/util/zlib.cc @@ -70,7 +70,7 @@ Status ZlibResultToStatus(int rc) { } // anonymous namespace Status Compress(Slice input, ostream* out) { - return CompressLevel(input, Z_DEFAULT_COMPRESSION, out); + return CompressLevel(input, Z_BEST_SPEED, out); } // See https://zlib.net/zlib_how.html for context on using zlib. diff --git a/src/kudu/util/zlib.h b/src/kudu/util/zlib.h index 0931d557f..778a22751 100644 --- a/src/kudu/util/zlib.h +++ b/src/kudu/util/zlib.h @@ -24,7 +24,9 @@ namespace kudu { namespace zlib { -// Zlib-compress the data in 'input', appending the result to 'out'. +// Zlib-compress the data in 'input', appending the result to 'out', using +// Z_BEST_SPEED compression level, i.e. best speed and decent compression +// ratio (that's level 1 in the context of CompressLevel() below). // // In case of an error, non-OK status is returned and some data may still // be appended to 'out'.
