<div class="gmail_quote">On Sat, Dec 12, 2009 at 11:29 PM, Juan Jose Garcia-Ripoll <span dir="ltr"><<a href="mailto:juanjose.garciaripoll@googlemail.com">juanjose.garciaripoll@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Streams may be opened with either ANSI C streams (fopen) or with C file descriptors (open). The later is needed for sockets and certain devices, while the formers provide buffering and may be better in some systems. That's all. The difference is that ECL did not allow C file descriptors to be used before.</blockquote>
<div><br></div><div>There was also another rationale for not using buffered files, which is that the system does buffer already. On ordinary file systems I see no performance difference between using ANSI C streams and file descriptors, as shown by the little script below. In both cases my Mac uses 0.177s to read and parse the file 10 times. However, since it seems that there are some filesystems around in which a call to read() may be expensive, LOAD now uses buffered streams. Given that there is also a relevant bug fixed that affects Maxima, I will produce a patch release soon.</div>
<div><br></div><div>Juanjo</div><div><br></div><div>(compile 'foo</div><div> '(lambda () (with-open-file (s "~/src/ecl/src/cmp/sysfun.lsp" :cstream t)</div><div> (loop for i = (read s nil nil)</div>
<div> while i))))</div><div>(time (dotimes (i 10) (foo)))</div><div>(compile 'foo</div><div> '(lambda () (with-open-file (s "~/src/ecl/src/cmp/sysfun.lsp" :cstream t)</div><div> (loop for i = (read s nil nil)</div>
<div> while i))))</div><div>(time (dotimes (i 10) (foo)))</div><div><br></div></div><br clear="all"><br>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://juanjose.garciaripoll.googlepages.com">http://juanjose.garciaripoll.googlepages.com</a><br>