@@ -23,19 +23,6 @@ const (
23
23
// This is the default. Do not enable compression without benchmarking for your particular use case first.
24
24
CompressionDisabled CompressionMode = iota
25
25
26
- // CompressionNoContextTakeover compresses each message greater than 512 bytes. Each message is compressed with
27
- // a new 1.2 MB flate.Writer pulled from a sync.Pool. Each message is read with a 40 KB flate.Reader pulled from
28
- // a sync.Pool.
29
- //
30
- // This means less efficient compression as the sliding window from previous messages will not be used but the
31
- // memory overhead will be lower as there will be no fixed cost for the flate.Writer nor the 32 KB sliding window.
32
- // Especially if the connections are long lived and seldom written to.
33
- //
34
- // Thus, it uses less memory than CompressionContextTakeover but compresses less efficiently.
35
- //
36
- // If the peer does not support CompressionNoContextTakeover then we will fall back to CompressionDisabled.
37
- CompressionNoContextTakeover
38
-
39
26
// CompressionContextTakeover compresses each message greater than 128 bytes reusing the 32 KB sliding window from
40
27
// previous messages. i.e compression context across messages is preserved.
41
28
//
@@ -48,6 +35,19 @@ const (
48
35
//
49
36
// If the peer does not support CompressionContextTakeover then we will fall back to CompressionNoContextTakeover.
50
37
CompressionContextTakeover
38
+
39
+ // CompressionNoContextTakeover compresses each message greater than 512 bytes. Each message is compressed with
40
+ // a new 1.2 MB flate.Writer pulled from a sync.Pool. Each message is read with a 40 KB flate.Reader pulled from
41
+ // a sync.Pool.
42
+ //
43
+ // This means less efficient compression as the sliding window from previous messages will not be used but the
44
+ // memory overhead will be lower as there will be no fixed cost for the flate.Writer nor the 32 KB sliding window.
45
+ // Especially if the connections are long lived and seldom written to.
46
+ //
47
+ // Thus, it uses less memory than CompressionContextTakeover but compresses less efficiently.
48
+ //
49
+ // If the peer does not support CompressionNoContextTakeover then we will fall back to CompressionDisabled.
50
+ CompressionNoContextTakeover
51
51
)
52
52
53
53
func (m CompressionMode ) opts () * compressionOptions {
0 commit comments