[plt-scheme] Iteration Performance

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Feb 27 14:40:37 EST 2009

At Fri, 27 Feb 2009 12:04:33 -0700, Doug Williams wrote:
> Iteration Performance
> [...]
> 
> Doing my own dispatching for vectors, lists, and general sequences is faster
> for vectors and lists - enough so that I would likely use it. [I suppose I
> could hide it in a macro.] But, does it make sense for 'for' itself to do
> such dispatching internally for the common types? That is, generate the
> equivalent of a cond around the fast code cases (e.g., vectors and lists)
> with an else for the general case?

I'm not sure. A macro shouldn't indiscriminately duplicate code, such
as a loop body in `for'. But maybe there's a way to expand that
encourages inlining by the compiler when the body is small. I'll think
about this more, and I'm open to further advice/suggestions.

> I was also surprised at how slow iteration over vectors is. It seems like it
> would be pretty much as fast as lists - it should just need to stride down
> the vector.

This is puzzling. Vectors are a little faster than lists on my machine.
Can you say more about your test environment (machine, DrScheme vs.
MzScheme, language settings if DrScheme, etc.)

> Sequence Operations
> 
> Has anyone written any general sequence operations already? 

Not as far as I know.




Posted on the users mailing list.