Opened 9 years ago

Last modified 17 months ago

#3073 new bug

Avoid reconstructing dictionaries in recursive instance methods

Reported by: simonpj Owned by:
Priority: lowest Milestone:
Component: Compiler Version: 6.10.1
Keywords: Inlining Cc: ganesh@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Ganesh writes: I have a problem in GHC 6.10 with functions in a class instance calling other functions in the same class instance. It seems that the dictionary is freshly constructed for this call, despite being already available.

The reason I care is that I want to memoise some expensive computations inside the dictionary for each instance. [Obviously I also have to make sure that the dictionary isn't constructed multiple times by external callers, but I can make other arrangements to ensure that.]

To see the problem in action, run main from the attached code. In GHC 6.8 and before, this only executes the trace statement once. In GHC 6.10, the trace statement executes twice, at all optimisation levels.

This seems related to #2902, but I'm a little unclear on whether it's the same problem or not.

Attachments (1)

RecDict.hs (675 bytes) - added by simonpj 9 years ago.
Recursive memoisation example

Download all attachments as: .zip

Change History (16)

Changed 9 years ago by simonpj

Attachment: RecDict.hs added

Recursive memoisation example

comment:1 Changed 9 years ago by igloo

Milestone: 6.12 branch

comment:2 Changed 8 years ago by simonmar

Type of failure: Runtime performance bug

comment:3 Changed 8 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:4 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:5 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:6 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:7 Changed 6 years ago by igloo

Milestone: 7.2.17.4.1

comment:8 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:9 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:10 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:11 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:12 Changed 3 years ago by thoughtpolice

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:13 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:14 Changed 23 months ago by thomie

Milestone: 8.0.1

comment:15 Changed 17 months ago by mpickering

Keywords: Inlining added
Note: See TracTickets for help on using tickets.