Strict tuples

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Mar 22 05:27:49 EST 2006


Hello Taral,

Wednesday, March 22, 2006, 2:14:17 AM, you wrote:

T> On 3/18/06, Manuel M T Chakravarty <chak at cse.unsw.edu.au> wrote:
>> Of course, the caller could invoke addmul using a bang patterns, as in
>>
>>   let ( !s, !p ) = addmul x y
>>   in ...
>>
>> but that's quite different to statically knowing (from the type) that
>> the two results of addmul will already be evaluated.  The latter leaves
>> room for more optimisations.

T> I looked back at this, and I'm not sure that this statement (which
T> appears to be the core reason for considering this) is true at all. I
T> don't see that more optimization follows from the availability of
T> information regarding the strictness of a function result's
T> subcomponents.

ghc uses unboxed tuples just for such sort of optimizations. instead
of returning possibly-unevaluated pair with possibly-unevaluated
elements it just return, say, two doubles in registers - a huge win



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-prime mailing list