RE: compilation of pattern-matching?

2009-03-25 Thread Simon Peyton-Jones
Indeed GHC does not attempt to retain the order of alternatives, although a) it might be possible to do so by paying more attention in numerous places b) GHC may do so already, by accident, in certain cases Observations: * The issue at stake is a small one: not the *number of tests* but *which

Re: compilation of pattern-matching?

2009-03-25 Thread Lennart Augustsson
You could imagine a pragma to say which branch is likely. f p1 = e1 f p2 = {-# LIKELY #-} e2 f p3 = e3 Is there some way to propagate pragmas through core transformations? -- Lennart On Wed, Mar 25, 2009 at 9:18 AM, Simon Peyton-Jones simo...@microsoft.com wrote: Indeed GHC does not attempt

RE: compilation of pattern-matching?

2009-03-25 Thread Simon Peyton-Jones
| You could imagine a pragma to say which branch is likely. | f p1 = e1 | f p2 = {-# LIKELY #-} e2 | f p3 = e3 | | Is there some way to propagate pragmas through core transformations? Not robustly. We do have Notes attached to core, which are more or less propagated though, but I make not

strace breaks cabal - how to find the problem?

2009-03-25 Thread Robin Green
On my obscure configuration (GHC 6.10.1, with pkgenv activated, on Fedora Linux rawhide running on a VirtualBox x86 VM with hardware virtualisation enabled), running strace on cabal causes it to misbehave, as described below. I don't know whether this is due to a bug in cabal, the GHC runtime,

Re: Problem with a second installed version of the syb package

2009-03-25 Thread Ian Lynagh
On Mon, Mar 23, 2009 at 10:53:19AM +0100, José Pedro Magalhães wrote: Bad interface file: C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1.20090314\Data\Generics.hi Something is amiss; requested module syb:Data.Generics differs from name found in the interface file

Re: strace breaks cabal - how to find the problem?

2009-03-25 Thread Simon Marlow
Robin Green wrote: On my obscure configuration (GHC 6.10.1, with pkgenv activated, on Fedora Linux rawhide running on a VirtualBox x86 VM with hardware virtualisation enabled), running strace on cabal causes it to misbehave, as described below. I don't know whether this is due to a bug in

Re: ANNOUNCE: GHC 6.10.2 Release Candidate 1

2009-03-25 Thread Simon Marlow
Manuel M T Chakravarty wrote: jutaro: This is the first answer I got from the gtk2hs mailing list. Please consider this issue seriously. Well there is a simple fix as Simon Marlow wrote, The fix is fiarly easy: use Foreign.Concurrent.mkForeignPtr with a foreign import. In fact, if as Axel

Re: Problem with a second installed version of the syb package

2009-03-25 Thread José Pedro Magalhães
Hello Ian, 2009/3/25 Ian Lynagh ig...@earth.li On Mon, Mar 23, 2009 at 10:53:19AM +0100, José Pedro Magalhães wrote: Bad interface file: C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1.20090314\Data\Generics.hi Something is amiss; requested module syb:Data.Generics

Re: compilation of pattern-matching?

2009-03-25 Thread Simon Marlow
(thanks to Simon PJ for an excellent summary of the issues) Lennart Augustsson wrote: You could imagine a pragma to say which branch is likely. f p1 = e1 f p2 = {-# LIKELY #-} e2 f p3 = e3 Is there some way to propagate pragmas through core transformations? I just thought I'd mention the

Re: compilation of pattern-matching?

2009-03-25 Thread Lennart Augustsson
When you tried switching Nil and Cons, did you try it on many examples? For a single example a 2-3% could be easily attributed to random effects like different instruction cache hit patterns. If you get it consistently over several programs then it seems likely to mean something, but I'm not sure

Re: compilation of pattern-matching?

2009-03-25 Thread Jan-Willem Maessen
On Mar 25, 2009, at 5:18 AM, Simon Peyton-Jones wrote: Indeed GHC does not attempt to retain the order of alternatives, although a) it might be possible to do so by paying more attention in numerous places b) GHC may do so already, by accident, in certain cases ... * Which plan performs

Re: compilation of pattern-matching?

2009-03-25 Thread Claus Reinke
| very long list than the Cons-before-Nil order I wanted), but it is | very frustrating if I'm not even given the chance because GHC | sorts the alternatives, not even according to its own interpretation | of branching performance, but completely arbitrarily!-) All I'm saying is that GHC has

Re: compilation of pattern-matching?

2009-03-25 Thread Claus Reinke
I don't find ordering of patterns appealing, I find it scary! I order my patterns according to the semantics I desire, and then additionally by what looks pretty. I'd like it if whatever cleverness GHC can work is used rather than requiring me to think. If the order of patterns is to become

RE: compilation of pattern-matching?

2009-03-25 Thread Duncan Coutts
On Wed, 2009-03-25 at 09:18 +, Simon Peyton-Jones wrote: * More promising might be to say this is the hot branch. That information about frequency could in principle be used by the back end to generate better code. However, I am unsure how a) to express this info in source

Re: compilation of pattern-matching?

2009-03-25 Thread Tyson Whitehead
On March 25, 2009 21:38:55 Claus Reinke wrote: If you don't have that kind of control, and generate code as if there were no hardware-level optimizations, the resulting mismatch will manifest in hard-to-predict variations in performance, making it difficult to see how much or why speed is