Tcl Source Code

Check-in [70e97884f0]
Login

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

Overview
Comment:Correct performance regression in a series of short binary reads from a socket. Many thanks to Eric Boudaillier for the report and testing support.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 70e97884f0a0517b5dc380b9560a8951c4ee1b20
User & Date: dgp 2014-08-22 13:23:04
References
2014-10-09
22:39 Ticket [ed29c4da21] http::get -channel broken on MacOS status still Open with 4 other changes artifact: 35a8cd4a92 user: aku
Context
2014-08-25
15:36
merge release check-in: 06a91f777f user: dgp tags: core-8-5-branch
2014-08-22
13:48
merge 8.5; fix notifier mask bug and Tcl_Read performance regression check-in: 8cf00e79f5 user: dgp tags: trunk
13:44
merge 8.5; stamp release date check-in: f3a4fbba3d user: dgp tags: rc2, core-8-5-16-rc
13:23
Correct performance regression in a series of short binary reads from a socket. Many thanks to Eric... check-in: 70e97884f0 user: dgp tags: core-8-5-branch
13:20
Same results; simpler logic. Closed-Leaf check-in: 5180649ac5 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.

8849
8850
8851
8852
8853
8854
8855

8856
8857
8858
8859

8860

8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
	 */

	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;

	    assert (bufPtr != NULL);

	    if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) {
		/* Further reads cannot do any more */
		break;
	    }
	    
	    if (code) {
		/* Read error */
		UpdateInterest(chanPtr);
		TclChannelRelease((Tcl_Channel)chanPtr);
		return -1;
	    }

	    assert (IsBufferFull(bufPtr));
	}

	assert (bufPtr != NULL);

	bytesRead = BytesLeft(bufPtr);
	bytesWritten = bytesToRead;

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







>
|
|
<
<
>

>

|
<
<
<
<
<
<
<
<
<
<





|
<


<
<







8849
8850
8851
8852
8853
8854
8855
8856
8857
8858


8859
8860
8861
8862
8863










8864
8865
8866
8867
8868
8869

8870
8871


8872
8873
8874
8875
8876
8877
8878
	 */

	if (GotFlag(statePtr, CHANNEL_EOF)
		&& (bufPtr == NULL || IsBufferEmpty(bufPtr))) {
	    break;
	}

	/*
	 * If there is not enough data in the buffers to possibly
	 * complete the read, then go get more.


	 */

	if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) {
	moreData:
	    if (GetInput(chanPtr)) {










		/* Read error */
		UpdateInterest(chanPtr);
		TclChannelRelease((Tcl_Channel)chanPtr);
		return -1;
	    }
	    bufPtr = statePtr->inQueueHead;

	}



	bytesRead = BytesLeft(bufPtr);
	bytesWritten = bytesToRead;

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