Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!MathWorks.Com!uhog.mit.edu!sgiblab!swrinde!howland.reston.ans.net!EU.net!uunet!sparky!kwiudl.kwi.com!netcomsv!netcomsv!netcom.com!hbaker
From: hbaker@netcom.com (Henry G. Baker)
Subject: Re: ? on efficient iteration over structures
Message-ID: <hbakerCxotuu.7t2@netcom.com>
Organization: nil
References: <LYLE.94Oct13122255@cogni.ai.mit.edu> <SIMON.94Oct13123801@ligsg6.epfl.ch> <37k2el$5q@tools.near.net>
Date: Sat, 15 Oct 1994 00:11:18 GMT
Lines: 27

In article <37k2el$5q@tools.near.net> barmar@nic.near.net (Barry Margolin) writes:
>In article <SIMON.94Oct13123801@ligsg6.epfl.ch> simon@lig.di.epfl.ch (Simon Leinen) writes:
>>To test whether the difference is due to overhead of the iteration
>>constructs rather than from caching effects, you should fill all slots
>>in the data structures with the same segment and try again.
>
>The way I like to determine iteration overhead is by replacing the call to
>the work function (EVAL-SEGMENT in his example) with a call to a function
>like:
>
>(defun no-op (&rest ignore)
>  (declare (ignore ignore))
>  nil)
>
>As to how to reduce iteration overhead, the best technique is probably loop
>unrolling.  Iteration over arrays is most easily amenable to this
>optimization technique.  And Lisp macros make it easy to write the code
>once.  Here's an (untested) macro to generate unrolled loops:

There's a discussion of loop-unrolling in Lisp in:

"Inlining Semantics for Subroutines which are Recursive".  ACM Sigplan
Not. 27,12 (Dec 1992), 39-46.  Also in my ftp directory.

      Henry Baker
      Read ftp.netcom.com:/pub/hbaker/README for info on ftp-able papers.

