[plt-scheme] build-list for large lists

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Apr 9 16:32:50 EDT 2009

On Apr  9, Matthias Felleisen wrote:
> Eli and I have had this long-running discussion. As Kent and Bob
> Hieb showed to me two decades ago, plain recursion usually wins in
> the context of an optimizing compiler because the compiler knows
> more about managing stacks and stuff than programmers do.
> I for one am happy to see that Eli is now wrong in the context of
> mzscheme :-)

Just to clarify "now" started probably more than a year ago, when I
stopped writing iterative loops to get more speed.

Iteration+`reverse!' was much faster for a really long time, then just
faster (not "much") since 3m, and then `reverse!' went out leaving
iteration+`reverse' or recursion at roughly the same speed.  Together
with improvements to the GC and the JIT, the recursive versions became
increasingly faster, while the iterative ones got left behind.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.