Tags: gobwas/ws
Tags
Remove common wsutil.Reader allocations (#189)  * `ws.ReadHeader` allocates a 12 byte temporary buffer to read the header into. Since `io.ReadFull` is used, it escapes to the heap. * `wsutil.NewCipherReader` is used for many calls. Since the `NextFrame` shouldn't have concurrent calls, both of these should be possible to have internally. I am forced to copy "readHeader" from `ws`, since there is not way to eliminate the alloc otherwise as far as I can tell.
wsflate: avoid double buffering when using flate.Reader (#137) This commit makes wsflate.suffixedReader to optionally implement io.ByteReader. That is, if source object is buffered (bytes.Reader, bufio.Reader etc.) and implements io.ByteReader, but suffixedReader not, then flate.NewReader() will allocate new bufio.Reader for it. This commit fixes it and adds runtime checks on suffixedReader source to hide ReadByte() method if source is a pure io.Reader. Fixes #130
PreviousNext