Skip to content

Commit 04b6a67

Browse files
codablockpanleone
authored andcommitted
Reserve 4k of buffer for CSerializedNetMsg buffer
Profiling has shown that a lot of time is spent in resizing the data vector when large messages are involved.
1 parent be1c4a7 commit 04b6a67

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/netmessagemaker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class CNetMsgMaker
1818
{
1919
CSerializedNetMsg msg;
2020
msg.command = std::move(sCommand);
21+
msg.data.reserve(4 * 1024);
2122
CVectorWriter{ SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward<Args>(args)... };
2223
return msg;
2324
}

0 commit comments

Comments
 (0)