Skip to content

Example where ghc 6.10.1 fails to optimize recursive instance function calls

Using ghc 6.10.1, I get over a 3x performance boost on the attached toy example, by moving instance function definitions out of the instance declaration, so that recursive calls avoid the class dictionary.

According to SPJ, ghc 6.10.1 is supposed to perform this optimization automatically. I am reporting it as a bug at his request, following a discussion on the glasgow-haskell-users@haskell.org list.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information