
#14941: Switching direct type family application to EqPred (~) prevents inlining in code using vector (10x slowdown) -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): I copied the core of `selectVectorDestructive2` from the good and bad examples and diffed them. They looked basically the same apart from lots and lots of code like the following: In bad: {{{ 1# -> case $wlvl_rnHf @ VUM.MVector @ Int @ IO Data.Vector.Unboxed.Base.$fMVectorMVectorInt ((Data.Vector.Primitive.Mutable.MVector @ ghc- prim-0.5.2.0:GHC.Prim.RealWorld @ Int ww1_smP2 ww2_smP3 ww3_smP4) `cast` (Sym (Data.Vector.Unboxed.Base.N:R:MVectorsInt[0] <ghc- prim-0.5.2.0:GHC.Prim.RealWorld>_N) ; Sym (Data.Vector.Unboxed.Base.DR:MVectorsInt0[0] (Control.Monad.Primitive.D:R:PrimStateIO[0])) :: (Data.Vector.Primitive.Mutable.MVector ghc- prim-0.5.2.0:GHC.Prim.RealWorld Int :: *) ~R# (VUM.MVector (PrimState IO) Int :: *))) ww4_smP8 of wild_00 { } }}} In good: {{{ 1# -> case $wlvl_rnRh ww2_smWB ww3_smWC ww4_smWG of wild_00 { } }}} So it looks like on every call the `MVector` is being constructed rather than created one and shared? Anyone know immediately why this is such a problem? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14941#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler