write_data spends too much time to create file.



On 8/3/10, Stefano Ferri <ferriste at gmail.com> wrote:

> (%i4) write_data(new,"new.dat");
> Evaluation took 0.9519 seconds (52.9844 elapsed) using 2.362 MB.

After looking at this a bit, I guess the problem is that Clisp
implementation of FINISH-OUTPUT takes a lot of time
(relatively speaking). FINISH-OUTPUT is called at the end of
each line in the current version of numericalio.lisp (yes, it doesn't
have to be, I agree). Do you see a difference in the time to
create a file with many lines versus a file with the same number
of elements but just one line? e.g.

x : matrix (makelist (i, i, 1, 1000)) $
write_data (x, "foo1.data");
write_data (transpose (x), "foo2.data");

I've changed numericalio.lisp to call FINISH-OUTPUT at most once.
You can get the new version from CVS, via the web interface if you like:
http://maxima.cvs.sourceforge.net/viewvc/maxima/maxima/share/contrib/numericalio/

Looks like suboptimal behavior on the part of Clisp but I
wouldn't call it a bug.

best

Robert Dodier