
#7367: Optimiser / Linker Problem on amd64 --------------------------------------------+------------------------------ Reporter: wurmli | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Build System | Version: 7.6.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Runtime performance bug | (amd64) Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by simonpj): I don't think `flopS` uses its continuation linearly! {{{ flopS :: Perm -> (Int -> IO a) -> IO a flopS !xs f = do let go !acc = do k <- peekElemOff xs 0 if k == 0 then f acc else flop (fromIntegral k) xs >> go (acc+1) go 0 }}} One call to `flopS` will give many calls to its argument `f`. Actually the new cardinality analyser does spot (and exploit) this kind of linearity. I'd be happy to hear more ideas as you get more familiar with GHC. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7367#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler