(websocket) use persistent member variable as temp variables to encode/decode zlib messages in order to reduce transient allocations

This commit is contained in:
Benjamin Sergeant
2020-04-13 21:38:15 -07:00
parent c57cf413fb
commit 37a054723a
6 changed files with 30 additions and 19 deletions

View File

@ -19,7 +19,7 @@ namespace ix
struct WebSocketMessage
{
WebSocketMessageType type;
std::string str;
const std::string& str;
size_t wireSize;
WebSocketErrorInfo errorInfo;
WebSocketOpenInfo openInfo;
@ -34,7 +34,7 @@ namespace ix
WebSocketCloseInfo c,
bool b = false)
: type(t)
, str(std::move(s))
, str(s)
, wireSize(w)
, errorInfo(e)
, openInfo(o)