gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: big loss on member with equal in 2.7.0


From: Camm Maguire
Subject: [Gcl-devel] Re: big loss on member with equal in 2.7.0
Date: 23 Sep 2005 13:43:54 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings, and thanks for your report!

Robert Boyer <address@hidden> writes:

> Here is huge (10X) loss of 2.7.0 over 2.6.6, which may account for some of
> the remaining Nqthm slowdown.
> 
> (setq foo (make-list 10000000) bar nil)
> 
> (defun me (x y) (member x y :test 'equal))
> 
> (compile 'me)
> 
> (time (me 'a foo))
> 
> 2.6.6   run-gbc time    :      0.100 secs
> 2.7.0   run-gbc time    :      1.120 secs
> 
> Bob
> 

Do you make use of compile, or compile-file mostly?  

The problem again stems from ansi compliance.  'compile must be able
to literally access the exact object of any constant mentioned in the
function or lambda list.  I.e.

(let ((x "abc")) (funcall (compile nil '(lambda nil (eq ,x ,x)))))
   -> t

unlike compile-file on f.l containing

(defun foo nil (eq "abc" "abc"))

We achieve this by wrapping all 'literals' in a load-time value form
like this

x -> `(load-time-value (si::nani ,(si::address x)))

This results in an entry in the .data file which will put the exact
object in the appropriate variable when the object is loaded.  

Unfortunately, it also confuses any compiler code which tries to take
special action based on the values of these supplied constants.  If
you check what is actually being compiled in your case, the contents
of the address of 'equal is taken at load time and used as a generic
function for an old-fashioned slow function call.  

A work around is to do (setq compiler::*keep-gaz* t).  This keeps the
temporary files corresponding to the compiled closures, as is used for
example in compiling pcl, for later use in a different lisp image, and
hence follows compile-file behavior even when invoking compile.  

I've already put in compile-time evaluations of any load-time-value
forms in key places in the compiler, and can plug this hole as well,
but am looking for a central place to do it.  Suggestions most
welcome.  You can look at wrap-literals, literalp, etc. in the
compiler package if interested.

On the bright side, when compiled as indicated above, our current
implementation is considerably faster than 2.6.6.  If the item type
allows, we now bump the equal test to eq:

=============================================================================
GCL (GNU Common Lisp)  2.7.0 ANSI    Sep 23 2005 15:38:08
Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
Binary License:  GPL due to GPL'ed components: (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.

>(defun me (x y) (member x y :test 'equal))

ME

>(compile 'me)

;; Compiling ./gazonk0.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 ./gazonk0.o.
Loading /fix/t1/camm/debian/gcl/tmp/tmp/foo/unixport/gazonk0.o
start address -T 0xa64a40 Finished loading 
/fix/t1/camm/debian/gcl/tmp/tmp/foo/unixport/gazonk0.o
#<compiled-function ME>
NIL
NIL

>(setq foo (make-list 10000000) bar nil)

NIL

>(time (me 'a foo))

real time       :      1.270 secs
run-gbc time    :      1.270 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

>(time (me 10000000000000 foo))

real time       :      1.280 secs
run-gbc time    :      1.280 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

>(defun me (x y) (member x y :test 'equal))

ME

>(let ((compiler::*keep-gaz* t)) (compile 'me))

;; Compiling ./gazonk0.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 ./gazonk0.o.
Loading /fix/t1/camm/debian/gcl/tmp/tmp/foo/unixport/gazonk0.o
start address -T 0x830100 Finished loading 
/fix/t1/camm/debian/gcl/tmp/tmp/foo/unixport/gazonk0.o
#<compiled-function ME>
NIL
NIL

>(time (me 'a foo))

real time       :      0.040 secs
run-gbc time    :      0.040 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

>(time (me 10000000000000 foo))

real time       :      0.120 secs
run-gbc time    :      0.130 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

>(time (me 10000000000000 foo))

real time       :      0.130 secs
run-gbc time    :      0.120 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

>
address@hidden:/fix/t1/camm/debian/gcl/tmp/tmp/foo/unixport$ 
address@hidden:/fix/t1/camm/debian/gcl/tmp/tmp/foo/unixport$ GCL_ANSI=t gcl
GCL (GNU Common Lisp)  2.6.7 ANSI    Sep 20 2005 18:40:24
Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
Binary License:  GPL due to GPL'ed components: (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.

>(defun me (x y) (member x y :test 'equal))

ME

>(compile 'me)

Compiling gazonk1.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling gazonk1.lsp.
Loading gazonk1.o
start address -T 0x8583d30 Finished loading gazonk1.o
#<compiled-function ME>
NIL
NIL

>(setq foo (make-list 10000000) bar nil)

NIL

>(time (me 10000000000000 foo))

real time       :      1.140 secs
run-gbc time    :      1.140 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

>(time (me 'a foo))

real time       :      1.130 secs
run-gbc time    :      1.140 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

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

Take care,

> 
> 

-- 
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]