On Mon, Oct 21, 2013 at 3:36 PM, Neil Van Dyke <n...@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, also. Sam ____________________ Racket Users list: http://lists.racket-lang.org/users