Skip to content

Commit 509436c

Browse files
authored
Perf[rmqa_compressiontransformerimpl]: deduce buffer size with ZSTD
ZSTD provides a helper function estimating the buffer size in the worst-case scenario. Signed-off-by: Evgenii Malygin <emalygin@bloomberg.net>
1 parent 28e794f commit 509436c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/rmq/rmqa/rmqa_compressiontransformerimpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ rmqt::Result<bool> CompressionTransformerImpl::transform(
6363

6464
// Allocate space for compressed data
6565
bsl::shared_ptr<bsl::vector<uint8_t> > compressedData =
66-
bsl::make_shared<bsl::vector<uint8_t> >();
67-
compressedData->resize(data->size());
66+
bsl::make_shared<bsl::vector<uint8_t> >(
67+
ZSTD_compressBound(data->size()));
6868

6969
// Perform the compression
7070
size_t compressedSize = ZSTD_compressCCtx(zctx,

0 commit comments

Comments
 (0)