tailscale/types/key
Mike O'Driscoll bb59942df2
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>
2026-03-24 18:08:08 -04:00
..
chal.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
control_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
control.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
derp_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
derp.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
disco_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
disco.go types/key: add NodePrivate.Raw32 and DiscoPrivateFromRaw32 2026-03-10 07:36:35 -07:00
doc.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
hardware_attestation.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
machine_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
machine.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
nl_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
nl.go all: fix typos in comments 2026-03-05 13:52:01 -08:00
node_test.go types/key: use AvailableBuffer for WriteRawWithoutAllocating (#19102) 2026-03-24 18:08:08 -04:00
node.go types/key: use AvailableBuffer for WriteRawWithoutAllocating (#19102) 2026-03-24 18:08:08 -04:00
util_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
util.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00