RE: space efficiency question

[redirected to haskell-cafe] No, GHC doesn't test pointer equality first. It's unsound to do so, since it might turn bottom into non-bottom, or remove `seq` calls that kill space leaks. S -----Original Message----- From: Frank Dellaert [mailto:frank@cc.gatech.edu] Sent: 18 December 2001 11:48 To: Simon Peyton-Jones; Haskell@haskell.org Subject: Re: space efficiency question Thanks ! Now, a small follow-up question: if I subsequently test 2 Instances whether they were instantiated with the same Attributes value, as in test (Instance a1 _) (Instance a2 _) = (a1==a2) will this be implemented efficiently ? I.e. will it check first whether the pointers happen to be the same, and only then do a full Eq comparison ? Cheers Frank ----- Original Message ----- From: Simon mailto:simonpj@microsoft.com Peyton-Jones To: Frank Dellaert mailto:frank@cc.gatech.edu ; Haskell@haskell.org Sent: Monday, December 17, 2001 10:24 AM Subject: RE: space efficiency question Now: if I have a couple of thousand of these Instances, created with the same Attributes value, as in: a = Attributes ["a","bc"] i0000 = Instance a [1,2] i0001 = Instance a [1,1] ... i7896 = Instance a [2,1] can I be assured that there are not thousands of actual copies of a but that they simply have a pointer to a ? I'm interested in the answer for both ghc (compiled/interpreted) as interpreted Hugs. Yes for GHC: you'll only get one copy of 'a'. Simon
participants (1)
-
Simon Peyton-Jones