[Openmcl-devel] FINISH-OUTPUT/fsync slowness

Waldek Hebisch hebisch at math.uni.wroc.pl
Sat Nov 8 08:27:24 PST 2014

Trying FriCAS with recent Closure CL on recent Linux I got
wery long compile time.  More precisely, real time was
quite long while CPU time was OK.  The reason was disc
activity.  FriCAS was using FINISH-OUTPUT which in Closure CL
seem to cause call to fsync.  Now, apparently in recent Linux
fsync is doing what it should do and flushes disc write cache...

I have worked around the problem by removing most calls to
FINISH-OUTPUT and replacing a few critical ones with FORCE-OUTPUT.
IMHO decision to call fsync from FINISH-OUTPUT is unfortunate.
ANSI wording for FORCE-OUTPUT say that it merely starts writing
out buffer but do not wait for write to finish.  In particular
FORCE-OUTPUT is allowed to use asynchronous I/O.  Which
means that when Lisp program wants to pass data in a file
to another program it should call FINISH-OUTPUT as FORCE-OUTPUT
may be still doing its work at time when another program wants
to read the data.

                              Waldek Hebisch
hebisch at math.uni.wroc.pl 

More information about the Openmcl-devel mailing list