Why is maxima file output so slow?



Hi,

I've just been running some tests as some computations we were doing
were taking a long time to output their results to file. In Maxima, to
generate a file with 100,000 lines of length 500, it takes around 8s
for me, and yet it seems this should take less than a second?

For example:

(%i12) A : apply(sconcat,create_list("1",i,1,500))$
Evaluation took 0.0000 seconds (0.0070 elapsed)
(%i13) with_stdout("test.txt", for i : 1 thru 100000 do print(A))$
Evaluation took 7.1600 seconds (7.4840 elapsed)

while with the following python script (test.py):

fh = open("test.txt", "w")
testline = "1" * 500 + "\n"
for i in range(0,100000):
  fh.write(testline)
fh.close()

we get:

~> time python test.py

real	0m0.186s
user	0m0.030s
sys	0m0.150s

This is using Maxima 5.23.2 and ECL 11.1.1 .

I understand that python is perhaps not the best example as it's
probably using native C libraries underneath, but is there any way to
speed things up? When one generates files with many many more lines,
this becomes a big problem, and otherwise the computation is not a
problem.

Thanks!

Matthew Gwynne
http://cs.swan.ac.uk/~csmg/