From 83a425d25af033086744c1c8c892015014ed46bd Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 1 May 2020 17:31:38 -0700 Subject: compressor: use a prevector in compressed script serialization Use a prevector for stack allocation instead of heap allocation during script compression and decompression. These functions were doing millions of unnecessary heap allocations during IBD. We introduce a CompressedScript type alias for this prevector. It is size 33 as that is the maximum size of a compressed script. Fix the DecompressScript header to match the variable name from compressor.cpp Signed-off-by: William Casarin --- src/compressor.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/compressor.h') diff --git a/src/compressor.h b/src/compressor.h index 478bfff0b6..40b2496f06 100644 --- a/src/compressor.h +++ b/src/compressor.h @@ -6,14 +6,26 @@ #ifndef BITCOIN_COMPRESSOR_H #define BITCOIN_COMPRESSOR_H +#include #include #include