summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-08-21 23:07:34 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-08-21 23:07:34 (GMT)
commitefe771bd6741517d20bc6260f4d3669d7a699b66 (patch)
tree63acdbd3c99b28e286b58dbf1ae80cd75cb49d8d
parent1701073d70f7be8200bd59362047199dedbd60b6 (diff)
downloadtcl-efe771bd6741517d20bc6260f4d3669d7a699b66.zip
tcl-efe771bd6741517d20bc6260f4d3669d7a699b66.tar.gz
tcl-efe771bd6741517d20bc6260f4d3669d7a699b66.tar.bz2
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.
-rw-r--r--generic/tclIO.c2
1 files changed, 2 insertions, 0 deletions
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;