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

Dolist inefficiency

    Date: Mon, 13 Feb 89 14:08:25 -0500
    From: andrew@unagi.cis.upenn.edu

    Why is dolist so inefficient? -

    > (progn (setf foo (loop for x below 1000 collect x)) nil)

    > (time (loop for x in foo do x))
    Evaluation of (LOOP FOR X IN FOO DO X) took 0.806763 seconds of elapsed time including:

    > (time (dolist (x foo) x))
    Evaluation of (DOLIST (X FOO)
		      X) took 19.384333 seconds of elapsed time including:
If you compile them, they take about the same amount of time, 0.007
seconds on my machine.  General rule is: Compile or it may take a long
-Bill Long