Pre-allocate return value in get_canonical
Since we know the worst-case size of a canonical statement is the size of the query string, we can reduce the number of memory allocations to one in the get_canonical function.
This commit is contained in:
parent
e386dcba88
commit
208a1d011e
@ -1367,6 +1367,7 @@ namespace maxscale
|
||||
std::string get_canonical(GWBUF* querybuf)
|
||||
{
|
||||
std::string rval;
|
||||
rval.reserve(gwbuf_length(querybuf) - MYSQL_HEADER_LEN + 1);
|
||||
mxs::Buffer buf(querybuf);
|
||||
|
||||
enum state
|
||||
|
Loading…
x
Reference in New Issue
Block a user