Skip to content

Commit 9fdcb5d

Browse files
committed
Misc fixes
1 parent fb3b083 commit 9fdcb5d

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# websocket
22

33
[![godoc](https://godoc.org/nhooyr.io/websocket?status.svg)](https://pkg.go.dev/nhooyr.io/websocket)
4-
[![coverage](https://img.shields.io/badge/coverage-86%25-success)](https://nhooyrio-websocket-coverage.netlify.app)
4+
[![coverage](https://img.shields.io/badge/coverage-89%25-success)](https://nhooyr.io/websocket/coverage.html)
55

66
websocket is a minimal and idiomatic WebSocket library for Go.
77

ci/test.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
set -eu
33
cd -- "$(dirname "$0")/.."
44

5+
(
6+
cd ./internal/examples
7+
go test "$@" ./...
8+
)
9+
(
10+
cd ./internal/thirdparty
11+
go test "$@" ./...
12+
)
13+
514
go install github.com/agnivade/wasmbrowsertest@latest
615
go test --race --bench=. --timeout=1h --covermode=atomic --coverprofile=ci/out/coverage.prof --coverpkg=./... "$@" ./...
716
sed -i.bak '/stringer\.go/d' ci/out/coverage.prof
@@ -12,12 +21,3 @@ sed -i.bak '/examples/d' ci/out/coverage.prof
1221
go tool cover -func ci/out/coverage.prof | tail -n1
1322

1423
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
15-
16-
(
17-
cd ./internal/examples
18-
go test "$@" ./...
19-
)
20-
(
21-
cd ./internal/thirdparty
22-
go test "$@" ./...
23-
)

compress.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

5353
func (m CompressionMode) opts() *compressionOptions {

make.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
set -eu
33
cd -- "$(dirname "$0")"
44

5+
echo "=== fmt.sh"
56
./ci/fmt.sh
7+
echo "=== lint.sh"
68
./ci/lint.sh
9+
echo "=== test.sh"
710
./ci/test.sh "$@"
11+
echo "=== bench.sh"
812
./ci/bench.sh

0 commit comments

Comments
 (0)