Some very rough benchmarks: folding over these two implementations of a binary tree
data Node1 a = Node1 a (Maybe (Node1 a)) (Maybe (Node1 a))

data Node2 a = Node2A a | Node2B a (Node2 a) | Node2C a (Node2 a) | Node2D a (Node2 a) (Node2 a)

with the latter of Simon's examples gives the following measurements when performing 100 traversals over randomly generated trees of size 3000:
                min    mean    +/-sd  median    max
Packed:    12.001  16.001   4.000  16.001  24.002
Unpacked:  12.000  13.144   1.952  12.001  16.001

(I'm not entirely sure what I'm doing, as this is my first contribution to the compiler proper, and pointers as to how to obtain more convincing benchmarks would be appreciated.)

My motivation is more philosophical than anything else, though:
The first two bullets are really the ones that grate on me -- that use of the UNPACK pragma in this fashion on multi-constructor types could be seriously useful to a programmer, but currently has no effect, and as a result, I would expect that implementing this proposal wouldn't cause problems in old programs and could be useful in new ones.

I think I'm making sense.  Would anyone else care to chime in?

Louis Wasserman
wasserman.louis@gmail.com


On Tue, Jul 21, 2009 at 6:38 PM, Don Stewart <dons@galois.com> wrote:
Might be interesting to try the transformation manually and benchmark?