#1434: Slow conversion from Double to Int
------------------------------------------+---------------------------------
    Reporter:  [EMAIL PROTECTED]  |        Owner:         
        Type:  bug                        |       Status:  new    
    Priority:  normal                     |    Milestone:         
   Component:  libraries/base             |      Version:  6.4.1  
    Severity:  normal                     |   Resolution:         
    Keywords:                             |   Difficulty:  Unknown
          Os:  Linux                      |     Testcase:         
Architecture:  Unknown                    |  
------------------------------------------+---------------------------------
Comment (by [EMAIL PROTECTED]):

 In a more compact example using the GHC compiler and optimizations there
 are no performance differences:

 {{{
 {-# OPTIONS -O2 -Wall #-}
 module Main where

 import GHC.Float (double2Int)

 main  :: IO ()
 main  = print (sum (map double2Int [-0.32,-0.29..(100000::Double)]) ::
 Int)

 main' :: IO ()
 main' = print (sum (map truncate   [-0.32,-0.29..(100000::Double)]) ::
 Int)
 }}}

 However in a more complicated application I have, I generated a signal
 with {{{round}}} in 4 seconds and with a replacement based on
 {{{double2Int}}} in only one second. This may indicate an insufficient
 inlining depth, but increasing it didn't help. Seems like I have to
 extract a working example to demonstrate that.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1434>
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