From 6f266985863acd4ff6a81e72e9833fd48007dffa Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 22 Feb 2021 12:38:41 +0800 Subject: [PATCH] reduce the zstd window size from 8 MB to 32 KB Benchmarks using sample qlog files show that this achieves in improvement in both compression efficiency and compression speed. More importantly, it prevents us from allocating a 8 MB every time a QUIC connection is closed. --- p2p/transport/quic/tracer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/transport/quic/tracer.go b/p2p/transport/quic/tracer.go index a31677254..d46a4a986 100644 --- a/p2p/transport/quic/tracer.go +++ b/p2p/transport/quic/tracer.go @@ -82,7 +82,7 @@ func (l *qlogger) Close() error { } defer f.Close() buf := bufio.NewWriter(f) - c, err := zstd.NewWriter(buf, zstd.WithEncoderLevel(zstd.SpeedFastest)) + c, err := zstd.NewWriter(buf, zstd.WithEncoderLevel(zstd.SpeedFastest), zstd.WithWindowSize(32*1024)) if err != nil { return err }