Greg Buchholz wrote:
>   You'd probably get a faster program with Unboxed arrays and
>   unsafeAccumArray.
>  

    Yeah, its about 20x faster unboxed and unsafe...

import Data.Array.Base

main = print $ quick_func $ take 1000000 $ cycle [1,2,3,1,2,9,1,9]

quick_func :: [Int] -> [(Int,Int)]
quick_func is = assocs f
    where
       f :: UArray Int Int
       f =  unsafeAccumArray (+) 0 (1,12) [(i, 1::Int) | i<-is]
           


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to