From 085b719be786b317eb5fa0daffa0b8905d2c29c1 Mon Sep 17 00:00:00 2001 From: samosvalishe Date: Mon, 18 May 2026 22:51:41 +0300 Subject: [PATCH] =?UTF-8?q?perf(bond):=20=D1=83=D0=B1=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B0=D0=BB=D0=BB=D0=BE=D0=BA=D0=B0=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=87=D0=B0=D0=BD=D0=BA=20=D0=B2=20copyTCPTo?= =?UTF-8?q?Bond?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit writeBondFrame пишет синхронно через w.Write, поэтому слайс буфера чтения безопасно передавать напрямую. Убирает одну аллокацию+копию на TCP-чанк на горячем пути upload. --- client/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/main.go b/client/main.go index ce58621..1ecb80c 100644 --- a/client/main.go +++ b/client/main.go @@ -1794,9 +1794,7 @@ func copyTCPToBond(ctx context.Context, connID uint64, tcpConn net.Conn, lanes [ for { n, err := tcpConn.Read(buf) if n > 0 { - data := make([]byte, n) - copy(data, buf[:n]) - lane, writeErr := writeBondFrameToNextLane(ctx, lanes, bondFrameData, seq, data, &laneIdx) + lane, writeErr := writeBondFrameToNextLane(ctx, lanes, bondFrameData, seq, buf[:n], &laneIdx) if writeErr != nil { log.Printf("[bond %d] write data error: %v", connID, writeErr) return