Lisp HUG Maillist Archive

LW 5 vs 6 performance

Hi there,

have a look at this function which is supposed give the CPU some load (I  
used it for SMP testing):

(defun test nil
   (loop repeat 1000 do (dotimes (x 2000000) (* 10 10))))

Nothing strange, right?

Not so. After compilation in LW5 the timing function produced the  
following result:

CL-USER 93 > (time (test))
Timing the evaluation of (TEST)

User time    =        1.294
System time  =        0.000
Elapsed time =        1.310
Allocation   = 6112 bytes
0 Page faults
NIL



The compiler output for the function looks like this:

;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 0
;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3
;;; Source level debugging is on
;;; Source file recording is  on
;;; Cross referencing is on
; (TOP-LEVEL-FORM 1)
; TEST

---- Press space to continue ----




Yet for the LW6 the same compiled function appears to be a lot slower:

CL-USER 22 > (time (test))
Timing the evaluation of (TEST)

User time    =        7.612
System time  =        0.000
Elapsed time =        7.620
Allocation   = 58676 bytes
0 Page faults
NIL


This is the compiler output on LW6. The difference is the INTERRUPTIBLE  
parameter is set to 1, however I was unable to force it to switch to 0 by  
using DECLARE.

;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 1
;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3
;;; Source level debugging is on
;;; Source file recording is  on
;;; Cross referencing is on
; TEST

---- Press Space to continue ----


Both of the functions seem to perform at comparable speeds when  
interpreted, only the fifth reports more allocation. Where do I look?


Re: LW 5 vs 6 performance

> Both of the functions seem to perform at comparable speeds when  
> interpreted, only the fifth reports more allocation. Where do I look?

You should probably try plugging this line into the both versions of your  
functions:

   (declare (optimize (speed 3) (compilation-speed 0) (safety 0) (debug 0)))

In this case LW6 performs even slightly faster.


Updated at: 2020-12-10 08:38 UTC