perf(mcp): avoid reallocating SSE buffer on each chunk (#1153)

This commit is contained in:
Nige
2026-03-14 15:47:48 -07:00
committed by GitHub
parent 71b1a6778b
commit 8753c48233
+3 -2
View File
@@ -212,9 +212,10 @@ impl HttpMcpTransport {
}
}
}
// Keep only the unprocessed trailing fragment.
// Keep only the unprocessed trailing fragment without allocating
// a new String each iteration.
if remaining_start > 0 {
buffer = buffer[remaining_start..].to_string();
buffer.drain(..remaining_start);
}
}