[GHC] #6135: Unboxed Booleans

GHC cvs-ghc at haskell.org
Thu Jun 7 15:10:19 CEST 2012


#6135: Unboxed Booleans
---------------------------------+------------------------------------------
    Reporter:  benl              |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.4.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by rl):

 Simon, your `&&` is strict in both arguments so it doesn't work.

 In general, I don't really think there is a lot to be gained here. You
 have to make sure that you (a) don't change the semantics of a program and
 (b) don't do too much unnecessary work. Let's take Ben's two examples:

 {{{
 case  x <# 0# || x >=# aWidth
     || y <# 0# || y >=# aHeight of
   True  -> ...
   False -> ...
 }}}

 {{{
 case    x .<# 0# .||# x .>=# aWidth
    .||# y .<# 0# .||# y .>=# aHeight of
  True#  -> ...
  False# -> ...
 }}}

 It is impossible to tell which of the two will be faster. If we expect `x
 <# 0` to hold most of the time, then the second one will be slower since
 it will be doing three unnecessary comparisons in most iterations for no
 benefit. On the other hand, if the condition doesn't hold most of the
 time, then the second one might be slightly faster.

 I fully agree that join points etc. can be very annoying, though.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6135#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list