diff options
| author | Mike O'Driscoll <mikeo@tailscale.com> | 2026-03-24 18:08:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-24 18:08:01 -0400 |
| commit | f52c1e3615629dd1ac8a2d73a5d9887245d4a2da (patch) | |
| tree | 2aca769ac73a7f9a091aae3d52e56e66a53f54bb /control/controlhttp/controlhttpserver | |
| parent | 9992b7c817676e964a30a168a2d4d921f5c09ac2 (diff) | |
| download | tailscale-f52c1e3615629dd1ac8a2d73a5d9887245d4a2da.tar.xz tailscale-f52c1e3615629dd1ac8a2d73a5d9887245d4a2da.zip | |
derp: use AvailableBuffer for WriteFrameHeader, consolidate tests (#19101)
Use bufio.Writer.AvailableBuffer to write the frame header directly
into bufio's internal buffer as a single append+Write, avoiding 5
separate WriteByte calls. Fall back to the existing writeUint32
byte-at-a-time path when the buffer has insufficient space.
```
name old ns/op new ns/op speedup
WriteFrameHeader-8 18.8 7.8 ~2.4x
(0 allocs/op in both)
```
Add TestWriteFrameHeader with correctness
checks, allocation assertions, and coverage of both fast and slow
write paths. Move BenchmarkReadFrameHeader from client_test.go to
derp_test.go alongside BenchmarkWriteFrameHeader, co-located with
the functions under test.
Updates tailscale/corp#38509
Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
Diffstat (limited to 'control/controlhttp/controlhttpserver')
0 files changed, 0 insertions, 0 deletions
