[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: common-lisp@SU-AI.ARPA
- Subject: loop speed
- From: AI.BOYER@MCC.ARPA
- Date: Wed, 05 Feb 1986 19:56:00 -0000
As Guy Steele recently pointed out, it is certainly the case
that constructs written with loop can often be recoded using
the mapping functions. I stopped using the mapping
functions a long time ago in Interlisp in large part because
I found that I.S.OPR expressions, the inspiration for loop,
ran significantly faster. Has the situation changed much?
I certainly have not made a careful comparison of the matter
recently, but I just timed the two following functions,
(defun remove-if-test (l)
(remove-if #'atom l))
(defun loop-test (l)
(loop for x in l unless (atom x) collect x))
Loop-test runs 3 to 4 times faster than remove-if-test in
Symbolics Common Lisp on a 3640 on long lists of nils.
Inspired by the fact that Guy can recode many uses of loop
into maps, perhaps someone can write a compiler that can
take maps back to loops for compilation efficiency!