
#16122: `round :: Double -> Int64` much slower than `fromIntegral @Int @Int64 . round` -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by akio): * cc: akio (added) Comment: In the interface file for GHC.Int I see: {{{ "round/Double->Int64" forall ($dRealFrac :: GHC.Real.RealFrac GHC.Types.Double) ($dIntegral :: GHC.Real.Integral Int64) GHC.Real.round @ GHC.Types.Double $dRealFrac @ Int64 $dIntegral = GHC.Base.. @ GHC.Types.Int @ Int64 @ GHC.Types.Double (GHC.Real.fromIntegral @ GHC.Types.Int @ Int64 GHC.Real.$fIntegralInt $fNumInt64) (GHC.Float.$fRealFracDouble_$cround @ GHC.Types.Int GHC.Real.$fIntegralInt) }}} So the RHS of the RULE already contains the bad code. This appears to be caused by the fact that the RHS of a rule is rewritten with GHC's built-in rules, even when there is a conflicting user-defined one. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16122#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler