On Thu, Jul 1, 2010 at 3:38 AM, Felipe Lessa
<felipe.lessa@gmail.com> wrote:
>> After suggestions by others I am thinking about
>> data Some elem = Single {-# UNPACK #-} !elem | More (Set elem)
>> or
>> data Some elem = Single {-# UNPACK #-} !elem | More {-# UNPACK #-} !elem
>> (Some elem)
>
> Unfortunately unpacking doesn't work for polymorphic fields (the new warning
> for ineffective unpack pragmas in GHC head should warn about this). Given
> this you might as well use a standard list.
However strictness information does work. But I don't know the answer
for the following questions:
- Should the elements be strict even while they are not unpacked?
Performance gains?
- Should the spine of the list be strict? Performance gains? Space leak gains?
In my experience/benchmarks strict spines are faster, probably due to better cache usage as the whole structure is updated at once. All the container data structures use strict spines.
Johan