Ticket #4138 (closed bug: fixed)
Performance regression in overloading
| Reported by: | simonmar | Owned by: | pcapriotti |
|---|---|---|---|
| Priority: | high | Milestone: | 7.6.1 |
| Component: | Compiler | Version: | 6.13 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Runtime performance bug | Difficulty: | Unknown |
| Test Case: | simplCore/shouldCompile/T4138 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
The following program goes 25% slower with HEAD compared to 6.12.3:
module Main (main) where
import DeepSeq
main :: IO ()
main = do
rnf [ mk x | x <- [ 1 .. 1024 ] ] `seq` return ()
where
mk :: Float -> [(Float,Float)]
mk x = [ (x+i,x+i+1) | i <- [ 1 .. 2048] ]
using the attached DeepSeq module, or indeed the standard Control.DeepSeq.
Simon and I diagnosed the problem to be the following dictionary for NFData (Float,Float) (this is HEAD):
Main.main6 :: DeepSeq.NFData (GHC.Types.Float, GHC.Types.Float)
Main.main6 =
DeepSeq.$fNFData(,)
@ GHC.Types.Float
@ GHC.Types.Float
DeepSeq.$fNFDataFloat
DeepSeq.$fNFDataFloat
GHC has not inlined the dictionary function or the arguments here, even though this class is in fact just a single-method dictionary. With 6.12 we got:
Main.main6 =
\ (ds_dBc :: (GHC.Types.Float, GHC.Types.Float)) ->
case ds_dBc of _ { (x_awr, y_aws) ->
case x_awr of _ { GHC.Types.F# _ ->
case y_aws of _ { GHC.Types.F# _ -> GHC.Unit.() }
}
}
i.e. everything fully inlined and a nice efficient definition.
This is currently affecting parallel programs where we typically use rnf quite a lot.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

