Skip to content
Tcl Source Code Artifact [acfda7793f]
Login

Artifact [acfda7793f]

Artifact acfda7793f90e8f70ed660b9e371ec9cb1e7c3c6:

Ticket change [acfda7793f] - Ticket [2901998fffffffff|2901998fff] <i>Inconsistent buffered I/O</i> status still Open with 4 other changes by andreas_kupries on 2009-12-01 01:12:23.
D 2009-12-01T01:12:23
J icomment Quoting\sKevin\sKenny\sfrom\shis\smail\son\sclt,\sthis\sseems\sto\sbe\sour\sbest\swriteup\sso\sfar\sof\swhat\swe\shave\sto\sdo:\n\n[...]\sthe\sproposed\ssolution\sentirely.\s\sIt's\smore\sor\sless:\n\n\s\s-\sPrior\sto\sa\s[read]\s(equivalently,\sa\s[gets]),\scheck\sif\sthere\n\s\s\s\sare\sbuffered\sdata\sto\swrite.\sIf\sthere\sare,\swrite\sthem\sbefore\n\s\s\s\sreading\sthe\sfile.\s(Obviously,\sany\sdata\sin\sread\sbuffers\smay\n\s\s\s\sbe\sretained.)\n\n\s\s-\sPrior\sto\sa\s[seek],\scheck\sif\sthere\sare\sbuffered\sdata\sto\n\s\s\s\swrite.\sIf\sthere\sare,\swrite\sthem\sbefore\sseeking.\n\n\s\s\s\sThere's\san\sobvious\sperformance\stweak\sto\sbypass\sthis\sflushing\n\s\s\s\sbehaviour\sif\sthe\s[seek]\sis\snot\sactually\smoving\sthe\scursor,\n\s\s\s\sand\sfurther\sperformance\smight\sbe\sobtainable\sif\sthe\slibrary\n\s\s\s\scan\sdetermine\sthat\sthe\snew\scursor\sis\sinside\sthe\scurrent\n\s\s\s\sbuffer.\sFor\snow,\sI\spropose\sto\signore\sthose\soptimizations,\n\s\s\s\swhich\srepresent\san\sunusual\scase\sthat\srequires\sa\sfair\sbit\n\s\s\s\sof\sbookkeeping\sto\smaintain\sconsistency.\n\n\s\s\s\sAs\sfar\sas\sinput\sbuffers\sgo,\sI'd\spropose\sflushing\sthem\son\n\s\s\s\s[seek]\sas\swell,\sbut\sit\swouldn't\sbe\sa\stremendous\samount\sof\n\s\s\s\sbookkeeping\sto\sdetect\sthe\scase\swhere\sthe\snew\scursor\slies\n\s\s\s\swithin\sthe\sbuffer\sand\sadjust\saccordingly.\sThis\sissue\smight\n\s\s\s\sbe\sworth\sdoing,\sbecause\sthere's\sa\splausible\scase\swhere\sa\n\s\s\s\sprogram\swill\sread\sdata\sfrom\sa\sfile,\suse\sthe\sdata\sjust\sread\n\s\s\s\sto\sinfer\sthe\sfile's\sencoding,\sseek\sback\sto\sthe\sbeginning,\n\s\s\s\sconfigure\sa\snew\sencoding\sand\sread\sagain.\n\n\s\s-\sPrior\sto\sa\s[puts],\sspoil\sany\sbuffered\sinput\sdata,\swhich\swill\n\s\s\s\sbe\sincoherent\safter\sthe\swrite.\s\sIf\sthe\scurrent\scursor\slies\n\s\s\s\swithin\san\sinput\sbuffer,\sit\smight\sbe\spossible\sto\sretain\sthe\n\s\s\s\sbuffer\sby\soverwriting\sthe\sdata\stherein\swith\sthe\snewly-written\n\s\s\s\sdata.\sAgain,\sI\spropose\ssimply\sto\signore\sthe\scase.\n\n\s\s-\sPrior\sto\sa\s[truncate],\sflush\swrite\sbuffers\sand\sdiscard\sread\n\s\s\s\sbuffers.\n
J login andreas_kupries
J mimetype text/plain
J username andreas_kupries
K 2901998fffffffffffffffffffffffffffffffff
U andreas_kupries
Z dae875134fa57161cef440a5790e6b9f