logo       

Re: loop performance bug: msg#00074

lang.haskell.glasgow.bugs

Subject: Re: loop performance bug

We can make it a little faster by not doing bound checks:

> test4 :: IO ()
> test4 = do
> (arr :: IOUArray Int Bool) <- newArray_ (0,100*100-1)
> doFromTo 0 9999 $ \_ ->
> doFromTo 0 99 $ \y ->
> doFromTo 0 99 $ \x ->
> unsafeWrite arr (x*(y+1)) False

Timings (compiled with -O2):
test1: 12.6s
test2: 8.5s
test3: 1.9s
test4: 1.3s

--
Friendly,
Lemmih


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise