Subject: load(draw) is very slow (takes about 13 seconds)
From: Volker van Nek
Date: Tue, 26 Mar 2013 18:05:32 +0100
Hi Max,
attached you'll find step by step instructions to compile and load the
draw package with sbcl. The instructions are for Linux but should be
very similar in Windows. Don't know whether Windows complains about
write permissions in /share/draw.
Good luck.
Volker
2013/3/26 Max Cohen <m.cohen at sowiso.nl>:
> Hi Volkert,
>
> Thanks for your answer. I thought SBCL was the fastest LISP for maxima, but
> apparently this is not the case when it needs to compile.
> Explicitly compiling the package sounds like a good plan for me, but I would
> not know where to begin. Can you help me on my way?
>
> thanks in advance
> Max Cohen
> Op 25-3-2013 15:09, Volker van Nek schreef:
>
> 13 sec is a long time. But I do not expect that this is a bug. I don't
> know but I can imagine that sbcl compiles when loading. draw is an
> uncompiled share package written in Lisp. I expect draw benefits from
> being compiled. If you wish you can explicitely compile the lisp files
> in this package and load the binaries. If you do so please note that
> draw.lisp itself loads Lisp files. Lines 38/39:
> ($load "grcommon.lisp")
> ($load "vtk.lisp")
>
>
> For the record. This is what I get on a 32-Bit xubuntu (1.6 GHz
> DualCore). Note the amount of space that sbcl reclaims when loading
> draw.
>
> using Lisp SBCL 1.0.57.0.debian
> (%i2) load(draw);
> Evaluation took 3.8360 seconds (3.8430 elapsed) using 336.824 MB.
>
> using Lisp Clozure Common Lisp Version 1.8-r15286M (LinuxX8632)
> (%i2) load(draw);
> Evaluation took 1.4760 seconds (1.4760 elapsed)
>
> using Lisp CMU Common Lisp Debian build debian/20c-2-1-g957a42a-dirty
> (20C Unicode)
> (%i2) load(draw);
> Evaluation took 0.1700 seconds (0.3400 elapsed) using 11.404 MB.
>
> using Lisp CLISP 2.49 (2010-07-07)
> (%i2) load(draw);
> Evaluation took 0.1640 seconds (0.1619 elapsed) using 5.021 MB.
>
> using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL)
> (%i2) load(draw);
> Evaluation took 0.0400 seconds (0.0400 elapsed)
>
>
> Volker van Nek
>
>
> 2013/3/25 Max Cohen <m.cohen at sowiso.nl>:
>
> Hello,
>
> On my system load(draw) is very slow (takes about 13 seconds).
> Loading other packages is fast.
>
> I?m on CentOS 5.9
> Maxima bug report tells me:
> Maxima version: "5.29.1"
> Maxima build date: "2013-03-25 10:57:26"
> Host type: "x86_64-unknown-linux-gnu"
> Lisp implementation type: "SBCL"
> Lisp implementation version: "1.0.38-2.el5"
>
> Anybody knows why this is so slow?
>
> regards
> Max Cohen
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
-------------- next part --------------
1. I start Maxima with administrative rights which allow me to write the binaries
and log files to /share/draw.
volker at uvw32:~$ sudo rmaxima -l sbcl
...
using Lisp SBCL 1.0.57.0.debian
...
2. First I check whether the tests run correctly.
The test file itself loads the package.
(%i1) showtime:true$
Evaluation took 0.0000 seconds (0.0000 elapsed) using 0 bytes.
(%i2) batch("rtest_draw.mac");
...
(%i3) load("draw")
Evaluation took 3.9440 seconds (3.9520 elapsed) using 336.821 MB.
...
(%i60) "END OF DRAW TESTS"
...
Evaluation took 8.2170 seconds (8.4330 elapsed) using 826.722 MB.
(%o60) /usr/local/share/maxima/branch_5_29_base_163_g929364c_dirty/share/draw/\
rtest_draw.mac
3. This tells me the path to the draw package.
I store it in a variable to shorten the path.
(%i61) path_to_draw : "/usr/local/share/maxima/branch_5_29_base_163_g929364c_dirty/share/draw/"$
4. draw.lisp is loaded by load(draw);
I open draw.lisp and I find two load commands.
($load "grcommon.lisp")
($load "vtk.lisp")
So I compile these two files first.
(%i62) compile_file(sconcat(path_to_draw, "grcommon.lisp"));
...
(%o62) [... grcommon.lisp, ... grcommon.fasl]
(%i63) compile_file(sconcat(path_to_draw, "vtk.lisp");
...
(%o63) [... vtk.lisp, ... vtk.fasl]
5. sbcl creates fasl-binaries. I want draw.lisp to load these.
;;($load "grcommon.lisp")
;;($load "vtk.lisp")
($load "grcommon.fasl")
($load "vtk.fasl")
After this change I compile draw.lisp and quit.
(%i64) compile_file(sconcat(path_to_draw, "draw.lisp"));
...
(%o64) [... draw.lisp, ... draw.fasl]
(%i65) quit();
6. Because I want to run the test again I start Maxima again with admin rigths.
Now load(draw); loads the binaries which is done in a relative short time
and the tests run OK again.
volker at uvw32:~$ sudo rmaxima -l sbcl
...
using Lisp SBCL 1.0.57.0.debian
...
(%i1) showtime:true$
Evaluation took 0.0000 seconds (0.0000 elapsed) using 0 bytes.
(%i2) batch("rtest_draw.mac");
...
(%i3) load("draw")
Evaluation took 0.2640 seconds (0.2650 elapsed) using 44.493 MB.
...
(%i60) "END OF DRAW TESTS"
...
Evaluation took 4.5240 seconds (4.7540 elapsed) using 534.381 MB.
...
(%i61) quit();
7. Next time I run Maxima as a normal user and load(draw); loads the binaries.
volker at uvw32:~$ rmaxima -l sbcl
...
using Lisp SBCL 1.0.57.0.debian
...
(%i1) showtime:true$
...
(%i2) load(draw);
Evaluation took 0.2720 seconds (0.2710 elapsed) using 44.495 MB.
(%i3) quit();
8. I set draw.lisp to its original version
($load "grcommon.lisp")
($load "vtk.lisp")
and remove the fasl-files because GCL is my standard Lisp. GCL loads draw.lisp fast enough.
volker at uvw32:~$ rmaxima
...
using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL)
...
(%i1) load(draw);
loadfile: failed to load ... /grcommon.fasl
-- an error. To debug this try: debugmode(true);
(%i2) quit();
volker at uvw32:~$ sudo rm /usr/local/share/maxima/branch_5_29_base_163_g929364c_dirty/share/draw/*.fasl