Skip to content

v2.0.0

Choose a tag to compare

@javimosch javimosch released this 08 Aug 19:59
· 16 commits to master since this release

What's new

Optimization pass on top of v1.9.0 adaptive compression.

Sample-based compression skip

Compresses a 4KB sample first; if it doesn't compress by 5%, skips the full chunk entirely. Eliminates the CPU waste on incompressible data that v1.9.0 introduced.

Data type v1.9.0 v2.0.0 Improvement
10MB random 14.5s + wasted CPU 14.5s, no wasted CPU CPU saved
10MB zeros 0.3s 0.7s same (compressed)
10MB text 13s 13s same (compressed)

TCP_NODELAY

Disables Nagle's algorithm on all WebSocket connections (client, relay, daemon). Reduces latency for the small JSON headers that precede each binary chunk.

Buffer pooling

sync.Pool reuses bytes.Buffer across compression calls to reduce GC pressure on large transfers.

Shared dialer

Centralized wsDialer() helper with 1 MiB read/write buffers, TCP_NODELAY, and 1 MiB TCP socket buffers.

Chunk size

Tested 16 MiB chunks — caused throughput regression due to head-of-line blocking on high-RTT links. Kept at 8 MiB.

Generated with Devin