Opened 11 years ago

Last modified 4 years ago

#3055 new bug

Int / Word / IntN / WordN are unequally optimized

Reported by: claus Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.11
Keywords: Cc: merehap@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case: simplCore/should_compile/T3055
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

A lot of thought has been put into optimizing usage of Int, but not all of these tweaks have been copied for usage of Word, and the specific-size versions of both have even fewer optimizations. The consequence is that switching from signed to unsigned, or from unspecified to specified size, can result in dramatic performance loss.

  • builtin rules (prelude/PrelRules) cover Int and Word, but not sized alternatives
  • SPECIALI[SZ]E pragmas cover Int, but little of the others. Try
    find libraries/ -name _darcs -prune -o -name *hs | 
      xargs grep SPECIAL | grep '\<Int\|\<Word'
    
  • some instances have special cases for Int, but not for the others (for instance, the Enum instance for Int uses specialised enumFromTo code, the Word version uses generic code; base/GHC/Enum.hs and base/GHC/Word.hs)
  • some RULES help optimizing the special cases for Int further (again, see the Enum instance for Int for an example)

See this thread Int vs Word performance? for more discussion.

related tickets: #2270, #3051

Change History (18)

comment:1 Changed 11 years ago by igloo

difficulty: Unknown
Milestone: 6.12.1

comment:2 Changed 10 years ago by igloo

Owner: set to igloo

comment:3 Changed 10 years ago by simonmar

Type of failure: Runtime performance bug

comment:4 Changed 10 years ago by igloo

Milestone: 6.12.16.12 branch
Owner: igloo deleted

comment:5 Changed 10 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:6 Changed 10 years ago by merehap

Cc: merehap@… added

comment:7 Changed 9 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:8 Changed 9 years ago by igloo

Milestone: 7.0.17.0.2

comment:9 Changed 9 years ago by igloo

Milestone: 7.0.27.2.1

comment:10 Changed 8 years ago by igloo

Milestone: 7.2.17.4.1

comment:11 Changed 8 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:12 Changed 7 years ago by igloo

Milestone: 7.6.17.6.2

comment:13 Changed 5 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:14 Changed 5 years ago by thomie

Priority: lowestnormal

comment:15 Changed 5 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:16 Changed 5 years ago by thomie

Test Case: simplCore/should_compile/T3055

The test has been passing for a while. Needs investigation to see if this ticket can be closed.

comment:17 Changed 4 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:18 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.