#5237: Inefficient code generated for x^2 --------------------------------------+------------------------------------- Reporter: scpmw | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.4.1 Component: libraries/base | Version: 7.0.3 Resolution: | Keywords: Testcase: | Blockedby: Difficulty: | Os: Linux Blocking: | Architecture: x86_64 (amd64) Failure: Runtime performance bug | --------------------------------------+-------------------------------------
Comment(by daniel.is.fischer): Yes. And with {{{ {-# RULES "^^^2/Both" forall (x :: Integer). x ^^^ (2 :: Integer) = x #-} }}} alongside the two others, that fires. Re sidenote: yes, it should be for safety. That occurred to me today too. I've done a few tests and so far GHC always was clever enough to share the expression, but it's better not to rely on it. With regard to the rule/specialisation competition, what if the `{-# SPECIALISE #-}` pragma is removed? Due to the `{-# INLINABLE #-}`, with optimisations, specialisations will (probably) be created at the call sites, won't they? So then we wouldn't need the extra rules. However, I think that the specialisations would be created in each module and not once per programme/package, and that would mean code-bloat. So what would be worse, more rules or the code-bloat? -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5237#comment:11> 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