Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,254
    • Issues 4,254
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 394
    • Merge Requests 394
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4138

Closed
Open
Opened Jun 16, 2010 by Simon Marlow@simonmarDeveloper

Performance regression in overloading

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.

Trac metadata
Trac field Value
Version 6.13
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
7.6.1
Milestone
7.6.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#4138