diff options
| author | Mike O'Driscoll <mikeo@tailscale.com> | 2026-03-24 18:08:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-24 18:08:08 -0400 |
| commit | bb59942df2612c7867791a202b43ec181bc6a1f3 (patch) | |
| tree | 18eabcab58766beb062f1c597c02108b2d99d867 /control/controlhttp/controlhttpserver/controlhttpserver.go | |
| parent | f52c1e3615629dd1ac8a2d73a5d9887245d4a2da (diff) | |
| download | tailscale-bb59942df2612c7867791a202b43ec181bc6a1f3.tar.xz tailscale-bb59942df2612c7867791a202b43ec181bc6a1f3.zip | |
types/key: use AvailableBuffer for WriteRawWithoutAllocating (#19102)
Use bufio.Writer.AvailableBuffer to write the 32-byte public key
directly into bufio's internal buffer as a single append+Write,
avoiding 32 separate WriteByte calls. Fall back to the existing
byte-at-a-time path when the buffer has insufficient space.
```
name old ns/op new ns/op speedup
NodeWriteRawWithoutAllocating-8 121 12.5 ~9.7x
(0 allocs/op in both)
```
Add BenchmarkNodeWriteRawWithoutAllocating and expand
TestNodeWriteRawWithoutAllocating to cover both fast (AvailableBuffer)
and slow (WriteByte fallback) paths with correctness and allocation
checks.
Updates tailscale/corp#38509
Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
Diffstat (limited to 'control/controlhttp/controlhttpserver/controlhttpserver.go')
0 files changed, 0 insertions, 0 deletions
