
28 Apr
2005
28 Apr
'05
1:23 p.m.
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]