@@ -23,19 +23,6 @@ const (
2323 // This is the default. Do not enable compression without benchmarking for your particular use case first.
2424 CompressionDisabled CompressionMode = iota
2525
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-
3926 // CompressionContextTakeover compresses each message greater than 128 bytes reusing the 32 KB sliding window from
4027 // previous messages. i.e compression context across messages is preserved.
4128 //
@@ -48,6 +35,19 @@ const (
4835 //
4936 // If the peer does not support CompressionContextTakeover then we will fall back to CompressionNoContextTakeover.
5037 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
5151)
5252
5353func (m CompressionMode ) opts () * compressionOptions {
0 commit comments