Zbigniew scripsit: > 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.
Et Felix confirmavit: > Multiple values involve more checking that returning an explicit > data structure, because the receiving continuation may or may > not be multiple-value aware. Returning a single result from a function > is a more fundamental operation than handling multiple-value > continuations, so will always be faster. It occurs to me that one place where multiple argument and multiple values are not dual in Scheme-as-we-know-it is that lambda is syntax but values is a function, so it's reliably knowable at compile time how many arguments a Scheme function requires (even if one is a rest list) but not how many values it returns. How about a little extension to lambda, whereby if the first (or last, or any) item in the lambda-list is a fixnum constant, that is taken as a reliable declaration of how many values it returns? (I'm not wedded to this syntax, if someone can think of something better.) This would cause any excess values to be discarded and not passed to the continuation, and any missing values to become void objects. In that way, the continuation could be compiled as a simple C function with a fixed number of arguments, making it literally just as fast as single-argument continuations and short-circuiting the chain of calls shown above. -- I now introduce Professor Smullyan, John Cowan who will prove to you that either [EMAIL PROTECTED] he doesn't exist or you don't exist, http://www.ccil.org/~cowan but you won't know which. --Melvin Fitting _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users