axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: [Axiom-mail] A slow summation


From: Bill Page
Subject: [Axiom-developer] Re: [Axiom-mail] A slow summation
Date: Fri, 15 Jun 2007 11:59:45 -0400

On 6/15/07, Waldek Hebisch wrote:
Bill Page wrote:
> ...
> I am quite sure that this is not a lisp implementation issue,
> but no I don't have a sbcl version of Axiom available. Do you?
> Still, maybe this is a job for someone who knows how to use
> the sbcl profiler to find out where the Axiom interpreter is
> spending all it's time - Waldek?
>

On my machine, I get the following (on the second run, to
exclude time for loading):

                                      gcl      sbcl          sbcl
                                             interpreted  compiled
 reduce(+,[1.0/i for i in 1..20000])   8.70      1.76        0.17
 [i for i in 1..20000];                6.23      0.78        0.01
 expand(1..20000);                     0         0.004       0.01

Comment: sbcl evaluator has two modes of operation: interpreted
and compiled.  In compiled mode the code is first compiled and
then the resulting machine code is run.  One can switch mode
setting variable sb-ext:*evaluator-mode*:

)lisp (setf sb-ext:*evaluator-mode* :compile)

or

)lisp (setf sb-ext:*evaluator-mode* :interpret)

sbcl profiler showed that 98% of time were spent in Lisp evaluator,
and that agrees very well with getting much higher speed using
compiled mode.


Waldek, thank you very much for running this comparison!

So, the conclusion might be that I was wrong: the slowness *is*
because of the way that Axiom interpreter runs this code in
interpreted mode in GCL, right? It could still be that this interpreted
Lisp code is not written in an optimal manner.

Maybe it is possible in GCL with some additional coding to also
convince GCL to compile the code first before executing it?
I know that Axiom includes the command:

 )set function compile on/off

that affects compilation of user defined functions in the interpreter.
Perhaps this can be extended to the [... for ... ] case?

Alternatively:

Camm, Tim, and Lisp et al., is there anything equivalent to:

 (setf sb-ext:*evaluator-mode* :compile)

in GCL? A quick google for this did not turn up anything.

Regards,
Bill Page.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]