Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,870
    • Issues 4,870
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #3055
Closed
Open
Created Mar 01, 2009 by claus.reinke@talk21.com@trac-claus.reinke

Int / Word / IntN / WordN are unequally optimized

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 (closed), #3051 (closed)

Trac metadata
Trac field Value
Version 6.11
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
Assignee
Assign to
Time tracking