Files
Vincent BernatandGitHub 66b47ee328 decoders: replace binary.Read with a version without reflection and allocations (#141)
Instead of allocating small slices, we rely on the fact that most call
sites are providing a `bytes.Buffer` and use the `Next()` method. For
sFlow decoding, in my case, we get a 33% speedup.

A `bytes.Reader` would even be more efficient, but unfortunately, they
don't have a `Next()` method.

While Go should be smart enough to make the allocation of `bs` on the
stack, it does not, even when `io.ReadFull()` is inlines.

```
decoders/utils/utils.go:23:13: make([]byte, n) escapes to heap
```
2023-08-18 19:38:00 -07:00
..