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

Re: floating-point efficiency: Lisp vs. Fortran (FYI)



> Two versions of the CL code were tested, one without declarations,
> the other fully spiced with declarations. The CL-code was compiled
> with (speed 3) optimization. The Fortran code was not particularly
> optimized. My observations:
> 
> 1. Declarations had little influence on CL-execution efficiency.

I have seen a large effect in some cases such as, say, summing
or scaling rows and columns of a matrix.  Some possibilities:

  * The CL you're using doesn't optimize floating point very well.

  * It optimizes floating point fairly well even without declarations
    so that declarations don't make a big difference.

  * Some potential optimizations aren't performed because of the
    way you wrote your code.  (Eg, perhaps you didn't specify
    result types using something like (THE DOUBLE-FLOAT ...).)

  * Your code does things that can't (easily?) be optimized.
    (For instance, it's hard for an implementation to avoid
    heap-allocating floats when passing them to a global procedure.)

  * You're using a non-primitive floating point operation that
    isn't implemented very well.  (For instance, I wouldn't be
    surprised if the log function was inefficiently implemented
    in several Common Lisps.)

  * You're doing some other thing, in addition to fp operations,
    that's inefficient.

-- jd