axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] Re: bees for bonnets (GCL safety definition)


From: Camm Maguire
Subject: [Axiom-developer] Re: bees for bonnets (GCL safety definition)
Date: 15 Jun 2007 22:08:27 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Greetings!  In 2.7.0, I've redefined safety 3 to leave unset
*compiler-push-events*, and have fixed the code so that the ansi
tests, which assume safe code, run correctly under the new mode.  The
hook is still in the source, and might be made accessible at safety 4
if that has any meaning.  The point is that with source inlining, one
can effectively have one inline for both safe and unsafe code by
simply treating the check-type et.al. calls differently.  Type
propagation eliminates many even when safety is on.  I.e. if the
compiler is working correctly, there appears to be no need for the old
draconian catch all mode, which is actually slower than interpretation
in some cases.

More work remains in this regard.  Notably, I need to get up the
courage to do car et.al as source inlines.  Should actually be
straightforward.

Here is my speed comparison now:

=============================================================================
address@hidden:/fix/t1/camm/debian/gcl/tmp/tmp/foo3/unixport$ ./saved_ansi_gcl
GCL (GNU Common Lisp)  2.7.0 ANSI    Jun 15 2007 19:48:03
Source License: LGPL(gcl,gmp,pargcl), GPL(unexec,bfd,xgcl)
Binary License:  GPL due to GPL'ed components: (XGCL READLINE BFD UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.

Temporary directory for compiler files set to /tmp/

>(load "/tmp/t1.l")

;; Loading /tmp/t1.l
;; Compiling /tmp/gazonk_26334_0.lsp.
;; End of Pass 1.  
;; End of Pass 2.  
;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, (Debug quality ignored)
;; Finished compiling /tmp/gazonk_26334_0.o.
;; Loading /tmp/gazonk_26334_0.o
 ;; start address -T 0xaabcc8 ;; Finished loading /tmp/gazonk_26334_0.o
;; Compiling /tmp/gazonk_26334_0.lsp.
;; End of Pass 1.  
;; End of Pass 2.  
;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, (Debug quality ignored)
;; Finished compiling /tmp/gazonk_26334_0.o.
;; Loading /tmp/gazonk_26334_0.o
 ;; start address -T 0xaaed30 ;; Finished loading /tmp/gazonk_26334_0.o
real time       :      3.120 secs
run-gbc time    :      2.930 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
;; Finished loading /tmp/t1.l
T

>
address@hidden:/fix/t1/camm/debian/gcl/tmp/tmp/foo3/unixport$ 
address@hidden:/fix/t1/camm/debian/gcl/tmp/tmp/foo3/unixport$ 
address@hidden:/fix/t1/camm/debian/gcl/tmp/tmp/foo3/unixport$ ./saved_ansi_gcl
GCL (GNU Common Lisp)  2.7.0 ANSI    Jun 15 2007 19:48:03
Source License: LGPL(gcl,gmp,pargcl), GPL(unexec,bfd,xgcl)
Binary License:  GPL due to GPL'ed components: (XGCL READLINE BFD UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.

Temporary directory for compiler files set to /tmp/

>(load "/tmp/t2.l")

;; Loading /tmp/t2.l
;; Compiling /tmp/gazonk_26345_0.lsp.
; (DEFUN BAR ...) is being compiled.
;; Warning: Type declaration was found for not bound variable AR
;; End of Pass 1.  
;; End of Pass 2.  
;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3, 
(Debug quality ignored)
;; Finished compiling /tmp/gazonk_26345_0.o.
;; Loading /tmp/gazonk_26345_0.o
 ;; start address -T 0xa4efc8 ;; Finished loading /tmp/gazonk_26345_0.o
;; Compiling /tmp/gazonk_26345_0.lsp.
;; End of Pass 1.  
;; End of Pass 2.  
;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3, 
(Debug quality ignored)
;; Finished compiling /tmp/gazonk_26345_0.o.
;; Loading /tmp/gazonk_26345_0.o
 ;; start address -T 0xaa7c68 ;; Finished loading /tmp/gazonk_26345_0.o
real time       :      2.290 secs
run-gbc time    :      2.120 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
;; Finished loading /tmp/t2.l
T

>
=============================================================================

ccing Walden as he asked about slow safety in GCL too.

Take care,

Robert Boyer <address@hidden> writes:

> Hi Henry,
> 
> Thanks for the kind reply.
> 
> > so the old arguments regarding extra instructions for
> > type checking should no longer be valid.
> 
> Alas, my general experience is that tedious, careful
> declarations still make a huge, huge difference in Lisp
> if one wants the fastest code possible.  For example,
> of the four Lisps I tried just now, the best of them
> (those fastest on test2, below, the one with
> declarations) were about 8 times faster on test2 than
> on test1, the one without the declarations.
> 
> 'good' here is just under a second for test2.
> 
> -------------------------------------------------------
> 
> ; test 1
> 
> (declaim (optimize (safety 3)))
> (defvar ar (make-array 100000000))
> (defun bar (i) (setf (aref ar i) 0))
> (compile 'bar)
> (defun test () (loop for i below 100000000 do (bar i)))
> (compile 'test)
> (time (test))
> 
> ; test 2
> 
> (declaim (optimize (safety 0) (speed 3)))
> (defvar ar (make-array 100000000 :element-type 'fixnum))
> (defun bar (i)
>   (declare (fixnum i)
>            (type (simple-array fixnum (100000000)) ar))
>   (setf (aref ar i) 0))
> (compile 'bar)
> (declaim (ftype (function (fixnum) fixnum) bar))
> (defun test () (loop for i fixnum below 100000000 do (bar i)))
> (compile 'test)
> (time (test))
> 
> -------------------------------------------------------
> 
> As has been wisely said, comparisons are invidious and
> benchmarking is a dark art, so I won't refer to any
> specific Lisps.
> 
> One tests proves nothing, especially when done by a
> bumbler like me.  But referring to 'my general
> experience' proves even less.
> 
> For the little it is worth,
> 
> Bob
> 
> P. S.  Something like CDR coding is certainly still a
> super idea.  The idea of spending 128 bits on conses
> that are so almost all zeros is, well, painful.
> 
> P. S.  I am clueless about 'graph reduction'.  Will
> look into it.
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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