fd-stream buffers flushing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
From: Ken Olum
Subject: Last byte of fd-stream buffers never used
To: <email address hidden>
Date: Fri, 17 Dec 2010 12:53:01 -0500
In output-wrapper in fd-stream.lisp, we have the code
`(when (<= (buffer-length obuf) (+ tail ,size)) ...
I think this test should be <, not <=. TAIL is the pointer to the
first free location, so if TAIL + SIZE = LENGTH, then we could store
SIZE bytes leaving TAIL = LENGTH, which would be OK. (Perhaps after
writing the last byte the buffer should be flushed, instead of waiting
for the next write, but that's another story.)
This result of this code is that the buffer of a character file
stream is written out after every 4095 characters, rather than every
4096, probably reducing filesystem efficiency.
I checked it in SBCL 1.0.43 on x86_64 Linux, as follows:
(defvar *test* nil)
(trace sb-impl:
(with-open-file (*test* "delete.me" :direction :output :if-exists :supersede)
(dotimes (i 16384)
(format t "~D " i)
(force-output)
(write-char #\z *Test*)))
You can see that only 4095 characters are written between flushes.
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
In 18c093eb771c1ab 038090863d99bf4 baf4224966