[elephant-devel] Pure-Lisp memutil?

Ian Eslick eslick at csail.mit.edu
Tue Nov 21 06:23:00 UTC 2006


That's a fair question.  You are right that (safety 0) vs. (safety 1)  
has a small effect.  Here's a simple example of some variations over  
settings.  I modified memutil.lisp to use declaim instead of local  
declares, then I ran a simple test case that mostly uses buffer-write- 
byte and buffer-write-int setting that declaim to various values.

Serialize and deserializing 10M long symbols (new serializer):

(optimize (speed 3) (safety 1) (space 0) (debug 0)): 8.12 sec
(optimize (speed 3) (safety 1) (space 0) (debug 0)): 8.13 sec
(optimize (speed 3) (safety 2) (space 1) (debug 2)): 11.5 sec
(optimize (speed 2) (safety 3) (space 1) (debug 3)): 28.7 sec
(optimize (speed 0) (safety 3) (space 2) (debug 3)): 28.5 sec

Same test on original serializer:
(optimize (speed 3) (safety 1) (space 0) (debug 0)): 43 sec
(optimize (speed 2) (safety 3) (space 1) (debug 3)): 426 sec  
(extrapolated from a 1M iteration run)

This was generated by Allegro 8.0 on an Core 2 MacBook Pro under Mac  
OS X.

The only real benefit to safety 0 for this code is removing the extra  
check to ensure that an integer op did not overflow the maximum  
fixnum.  For this code there are enough other instructions my guess  
is that a modern CPU can execute these extra checks in parallel to  
other bookkeeping functions without any impact on throughput.  It  
might make a difference if you were doing alot more math than base 
+offset style computations.

Ian


On Nov 21, 2006, at 12:07 AM, Pierre THIERRY wrote:

> Scribit Ian Eslick dies 20/11/2006 hora 20:38:
>> Can you expand on your thinking as to why the user may want to turn
>> off optimizations and by what mechanism you would suggest doing   
>> that?
>
> I'm only really worried by the safety declarations. It should be a
> choice from the user to reduce safety, even for well-tested code.
>
>> For production use the optimizations make sense.
>
> Why not let the user choose it when in production?
>
>> they're speed critical so it's reasonable to run them fast  and you
>> can always turn that off by the above methods.
>
> I can understand the rationale for declaring them so optimized. Are
> there numbers about the speed difference with and without  
> optimizations?
>
> Curiously,
> Pierre
> -- 
> nowhere.man at levallois.eu.org
> OpenPGP 0xD9D50D8A
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel




More information about the elephant-devel mailing list