#3055: Int / Word / IntN / WordN are unequally optimized
-------------------------------------+--------------------------------------
Reporter:  claus                     |          Owner:                  
    Type:  run-time performance bug  |         Status:  new             
Priority:  normal                    |      Component:  Compiler        
 Version:  6.11                      |       Severity:  normal          
Keywords:                            |       Testcase:                  
      Os:  Unknown/Multiple          |   Architecture:  Unknown/Multiple
-------------------------------------+--------------------------------------
 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 [http://www.haskell.org/pipermail/glasgow-haskell-
 users/2009-February/016705.html "Int vs Word performance?"] for more
 discussion.

 related tickets: #2270, #3051

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3055>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to