[Ecls-list] ECL reads sysfun.lsp one byte at a time, was: Maxima stats huge numbers of files at startup?
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at googlemail.com
Sun Dec 13 10:05:46 UTC 2009
On Sat, Dec 12, 2009 at 11:29 PM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at googlemail.com> wrote:
> 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.
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.
Juanjo
(compile 'foo
'(lambda () (with-open-file (s "~/src/ecl/src/cmp/sysfun.lsp" :cstream t)
(loop for i = (read s nil nil)
while i))))
(time (dotimes (i 10) (foo)))
(compile 'foo
'(lambda () (with-open-file (s "~/src/ecl/src/cmp/sysfun.lsp" :cstream t)
(loop for i = (read s nil nil)
while i))))
(time (dotimes (i 10) (foo)))
--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20091213/dbed61f2/attachment.html>
More information about the ecl-devel
mailing list