On 18-May-09, at 8:57 PM, Gustavo wrote:
> There is some code  I tried to compile here and I get a strange
> behavior. I could isolate the problem, so, here is a short version.
> The file test.lisp has the following contents:
> (mid (floor (+ lo hi) 2) (floor (+ lo hi) 2))
> Now, adding the declarations
> (proclaim '(optimize (speed 3) (safety 0) (debug 0) (space 0)
> (compilation-speed 0)))
> and compiling the file gives lots of strange compiler notes for the
> second call of the function floor. However, if you omit the (space
> 0) declaration, no compiler note is given at all.
> Some tests with this benchmark code  show that this strange
> behavior make the code in  runs slower when the (space 0)
> declaration is given (the difference is HUGE, the code actually
> takes the double of the time to run!).
(SPACE 0) enable the inlining of FLOOR before the transform for FLOOR
with a power of 2 has a chance to fire. As a quick workaround, you
could use TRUNCATE instead of FLOOR. It would probably be a good idea
to remove the [MAYBE-]INLINE declaration for CEILING, FLOOR, REM and
MOD and perform it explicitly in transforms.