On Mon, Feb 24, 2003 at 10:14:02AM -0500, rif wrote:
>
> As the arrays get longer, both versions get slower, but the structure
> version becomes much slower in relative terms.  I conjecture that this
> is because of cache miss effects.
>
> [snip proof]
>
> but I think it does show that it's
> possible for the difference in timings between arrays of structures and
> directly coded arrays to be quite large.

True, but--back to the original topic of optimizing Lisp--you're going
to see the same problem in C.  It will certainly fit a larger set in 
the cache (won't have to store the pointer as well as the object with
its Lisp header) but it will happen none the less.

Your post seemed language agnostic, so you probably realize this.
The Lisp zealot in me had to speak.

I'd be kind of interested in seeing equivalent C and finding out how
much it beats Lisp, but I'm not interested enough to write it. :) 

On an even more basic level, this behaviour isn't always a bad thing
because it can be exploited (often with structures you operate on 
several different fields at the same time--it's nice when they can
all be fetched at once).  It comes down to choosing the best data
representation for your (Lisp/C/SNOBOL) application based on its
spatial reference patterns.  Some languages make abstractions
that allow implementation of hindsight significantly easier then
others, however. :)

Gabe Garza

Reply via email to