[racket] Small and short-lived data structures

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Mon Oct 21 15:41:31 EDT 2013

On Mon, Oct 21, 2013 at 3:36 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> Sam Tobin-Hochstadt wrote at 10/21/2013 02:35 PM:
>> https://gist.github.com/samth/7088570
> [...]
>> Direct is always fastest, multiple values are very slow, and cons is
>> always slower than mcons.
> Is there any relatively low-hanging fruit optimization that can be done for
> multiple-value returns in general?
> I'm not surprised that pairs are fast in this example, since pairs are both
> basic and have a special place in the history of Lisps.  But I like to
> pretend that multiple-value returns in Racket are often optimized (perhaps
> to registers, but at least to not worse than using a pair or pairs).

A little bit more smarts in the inliner/constant-folder could turn the
multiple-values version of the code into the direct version of the
code, I think.  But that wouldn't really address your question, since
it's unlikely that most uses of multiple values are this immediately
removable.  To really judge the difference between multiple values and
others, you'd want some different and more intelligent benchmarks,


Posted on the users mailing list.