Tcl Source Code

Check-in [85cd086fd2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dgp-slow-read
Files: files | file ages | folders
SHA1: 85cd086fd277438a7242118c851cb5ae7cb289f3
User & Date: dgp 2014-08-21 23:07:34
Context
2014-08-22
13:20
Same results; simpler logic. Closed-Leaf check-in: 5180649ac5 user: dgp tags: dgp-slow-read
2014-08-21
23:07
Test fix for likely cause of reported I/O slowdown. In a DoRead() revision, it came to favor making ... check-in: 85cd086fd2 user: dgp tags: dgp-slow-read
2014-08-20
18:59
Fix reviewed and accepted. check-in: ff52fbb4ac user: andreask tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIO.c.

8851
8852
8853
8854
8855
8856
8857

8858
8859
8860
8861
8862
8863
8864
	if (GotFlag(statePtr, CHANNEL_EOF)
		&& (bufPtr == NULL || IsBufferEmpty(bufPtr))) {
	    break;
	}

	/* If there is no full buffer, attempt to create and/or fill one. */


	while (!IsBufferFull(bufPtr)) {
	    int code;

	moreData:
	    code = GetInput(chanPtr);
	    bufPtr = statePtr->inQueueHead;








>







8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
	if (GotFlag(statePtr, CHANNEL_EOF)
		&& (bufPtr == NULL || IsBufferEmpty(bufPtr))) {
	    break;
	}

	/* If there is no full buffer, attempt to create and/or fill one. */

if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) {
	while (!IsBufferFull(bufPtr)) {
	    int code;

	moreData:
	    code = GetInput(chanPtr);
	    bufPtr = statePtr->inQueueHead;

8876
8877
8878
8879
8880
8881
8882

8883
8884
8885
8886
8887
8888
8889
		return -1;
	    }

	    assert (IsBufferFull(bufPtr));
	}

	assert (bufPtr != NULL);


	bytesRead = BytesLeft(bufPtr);
	bytesWritten = bytesToRead;

	TranslateInputEOL(statePtr, p, RemovePoint(bufPtr),
		&bytesWritten, &bytesRead);
	bufPtr->nextRemoved += bytesRead;







>







8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
		return -1;
	    }

	    assert (IsBufferFull(bufPtr));
	}

	assert (bufPtr != NULL);
}

	bytesRead = BytesLeft(bufPtr);
	bytesWritten = bytesToRead;

	TranslateInputEOL(statePtr, p, RemovePoint(bufPtr),
		&bytesWritten, &bytesRead);
	bufPtr->nextRemoved += bytesRead;