From efe771bd6741517d20bc6260f4d3669d7a699b66 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 21 Aug 2014 23:07:34 +0000 Subject: Test fix for likely cause of reported I/O slowdown. In a DoRead() revision, it came to favor making every effort to fill buffers, in preference to a more sensible goal of favoring avoiding calls out to the driver if there's already enough data in the buffers to satisfy the read operation. Result is many more calls out to recv() than are a good idea. Ought to show up most glaringly when many Tcl_Read() calls asking for small numbers of bytes (compared to buffer size) each, and that matches the reported case. --- generic/tclIO.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclIO.c b/generic/tclIO.c index 4452ae9..4f81770 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8855,6 +8855,7 @@ DoRead( /* If there is no full buffer, attempt to create and/or fill one. */ +if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) { while (!IsBufferFull(bufPtr)) { int code; @@ -8880,6 +8881,7 @@ DoRead( } assert (bufPtr != NULL); +} bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; -- cgit v0.12