#3059: 3 different behaviours depending on profiling settings and on a
used-only-
once form being top-level
----------------------+-----------------------------------------------------
Reporter: jkff | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Testcase:
Os: Windows | Architecture: x86
----------------------+-----------------------------------------------------
Comment (by ChrisKuklewicz):
In specializing regex-tdfa (post 1.0.0) for "matchTest" with strict
bytestrings, I wrote code that worked great as I posted above.
I am always compiling with -O2 on PPC G4.
But only with -prof. Without -prof it took 4.0 seconds instead of 0.3
seconds (and half of that is overhead).
I used "ghc-core" to look at the core and saw nothing wrong.
I commented out everything and made tiny modifications. I have over 12
test versions before I narrowed it down to using mplus. Note: mplus is
not in the core output by name.
{{{
case (IntMap.lookup ...) `mplus` maybeDefault of
Nothing -> False
Just -> ....iterate the loop...
}}}
And replacing mplus with my own two-stage case or the new "mm" combinator
fixed it.
{{{
{-# INLINE mm #-}
mm :: Maybe Transition -> Maybe Transition -> (DT -> Bool) -> Bool
mm (Just (Transition {trans_many=DFA {d_dt=dfa'}})) _ f = f dfa'
mm Nothing (Just (Transition {trans_many=DFA {d_dt=dfa'}})) f = f dfa'
mm Nothing Nothing _ = False
}}}
So GHC really did not do the right thing with my code.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3059#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs