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

Labels are slow!



Hello!

While testing some program-generated Lisp-Code, I discovered a strange
behaviour of labels in ACL. The two functions below obviously do the
same (hm, nothing useful..), but the version with the labels uses about
7.2MB of memory when called a 50000 times; test0, on the other hand,
needs only 32 bytes! Of course, there also is a loss of performance, about
factor 80 or so. 

(defun test0 (cnode) 
  (OR (AND (EQ CNODE 'A) (symbolp cnode)) 
      (AND (EQ CNODE 'B) (symbolp cnode))
      (AND (EQ CNODE 'C) (symbolp cnode))))

(defun test1 (cnode)
  (LABELS ((ZGEN-580 NIL
	     (DECLARE (INLINE ZGEN-579))
	     (OR (AND (EQ CNODE 'A) (ZGEN-579))
		 (AND (EQ CNODE 'B) (ZGEN-579))
		 (AND (EQ CNODE 'C) (ZGEN-579))))
	   (ZGEN-579 NIL (symbolp cnode)))
    (ZGEN-580)))


BTW, the (declare (inline .. trick is ignored by the compiler. Other
Lisps (e.g. Lucid) don't show such extreme use of memory and time.

Is there a way to fix this?

/<arsten /<onrad