[Haskell-cafe] Small optimisation question

2007-11-17 Thread Andrew Coppin
Suppose I write something like this: foo :: [Int] foo = concat (replicate 4 [4,7,2,9]) The value of foo is completely determined at compile-time. So, will the compiler generate calls to concat and replicate, or will it just insert a large list constant here? Obviously, once somebody has

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 04:01:34PM +, Andrew Coppin wrote: Suppose I write something like this: foo :: [Int] foo = concat (replicate 4 [4,7,2,9]) The value of foo is completely determined at compile-time. So, will the compiler generate calls to concat and replicate, or will it just

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Andrew Coppin
Stefan O'Rear wrote: On Sat, Nov 17, 2007 at 04:01:34PM +, Andrew Coppin wrote: Suppose I write something like this: foo :: [Int] foo = concat (replicate 4 [4,7,2,9]) The value of foo is completely determined at compile-time. So, will the compiler generate calls to concat and

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 04:10:58PM +, Andrew Coppin wrote: Stefan O'Rear wrote: On Sat, Nov 17, 2007 at 04:01:34PM +, Andrew Coppin wrote: Suppose I write something like this: foo :: [Int] foo = concat (replicate 4 [4,7,2,9]) The value of foo is completely determined at

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Andrew Coppin
Stefan O'Rear wrote: On Sat, Nov 17, 2007 at 04:10:58PM +, Andrew Coppin wrote: OK. I presume this is due to the fact that the result of executing an expression at compile-time could be arbitrarily large? Yes, and it's not even guaranteed to terminate. That would be

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 04:31:33PM +, Andrew Coppin wrote: Both. A curious feature of the STG machine is that constructor thunks and evaluated data are represented identically in memory. Ooo... As per the Lambdacats Boxed cat has a uniform representation? Well, presumably the guys who

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Andrew Coppin
Stefan O'Rear wrote: On Sat, Nov 17, 2007 at 04:31:33PM +, Andrew Coppin wrote: Well, presumably the guys who designed STG did it this way for a really good reason, and they know far more than me, so... ;-) The STG-machine was brilliant when it was designed, but times have

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Jake McArthur
On Nov 17, 2007, at 11:26 AM, Stefan O'Rear wrote: The STG-machine was brilliant when it was designed, but times have changed. In particular, indirect jumps are no longer cheap. Pointer tagging has allowed STG to hobble into the 21st century, but really the air is ripe for a new abstract

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 12:39:14PM -0600, Jake McArthur wrote: On Nov 17, 2007, at 11:26 AM, Stefan O'Rear wrote: The STG-machine was brilliant when it was designed, but times have changed. In particular, indirect jumps are no longer cheap. Pointer tagging has allowed STG to hobble into the

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread jerzy . karczmarczuk
Stefan O'Rear writes: Jake McArthur wrote: On Nov 17, 2007, at 11:26 AM, Stefan O'Rear wrote: The STG-machine was brilliant when it was designed, but times have changed. ... really the air is ripe for a new abstract machine. Do you know of any candidates? Hahaha - no. (Do ask John