On 1/31/08, John Cowan <[EMAIL PROTECTED]> wrote: > Well, as I said, in Chicken values (multiple or otherwise) become the > arguments of the continuation function, so they may or may not be on > the C stack depending on what gcc does with them.
A multiple-value call takes the following route under Chicken: C_call_with_values -> C_do_apply -> C_values -> values_continuation -> C_do_apply. A single-value call is compiled to a function call. You can see why returning a single list value and destructuring it should be a lot faster. I ran Alex's test on a fast machine (Intel C2D 2GHz). Compiled with `csc -Ob values.scm`, Chicken 3.0.1 macosx-unix-gnu-x86, results below. I got the same disparity as Alex. I would be curious as to what platform you're running on, because I want it. None of this would usually matter because benchmarks are next to useless. However, one major argument advanced for multiple values seems to be that the compiler has a chance to optimize them (which sounds like premature optimization to me, but I digress). So, if you're going to use multiple values, don't do it because of a theoretical speedup, but because it semantically fits the problem. ---- VALUES -------------------------------------------------- 22.512 seconds elapsed 0.302 seconds in (major) GC 0 mutations 5036 minor GCs 821 major GCs ---- LIST ---------------------------------------------------- 0.364 seconds elapsed 0 seconds in (major) GC 0 mutations 7326 minor GCs 0 major GCs _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users