Skip to content

Commit 4f3ab3e

Browse files
committed
Set the expected length of the buffer correctly.
This reduces the allocations for the "ExecuteScalarNewSync" scenario by 10%.
1 parent 91e749c commit 4f3ab3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MySqlConnector/MySqlClient/MySqlStatementPreparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public MySqlStatementPreparer(string commandText, MySqlParameterCollection param
1717

1818
public ArraySegment<byte> ParseAndBindParameters()
1919
{
20-
using (var stream = new MemoryStream(m_commandText.Length))
20+
using (var stream = new MemoryStream(m_commandText.Length + 1))
2121
using (var writer = new BinaryWriter(stream, Encoding.UTF8))
2222
{
2323
writer.Write((byte) CommandKind.Query);

0 commit comments

Comments
 (0)