[Arrays] Random Access Times ?

Hal Daume III hdaume@ISI.EDU
Sat, 3 May 2003 10:45:43 -0700 (PDT)


This is likely because it takes a while to construct that long list (i.e.,
test).  Moreover, I'm not sure what the 'x' is in your map function (note
that it's probably easier to use mapM_ rather than sequence/map.

I think the following would fare much better:

main = do
  testing <- newIOArray (0,60000) (Lesson ...)
  mapM_ (\x -> writeIOArray (Lesson "" 1 2 "" "")) [0..60000]
  a <- readIOArray testing 0
  putStr (decompose a)

> main = do
> 	testing <- newIOArray (0,60000) (Lesson "Hallo" 0 0
> "" "")
> 	sequence(map(writeIOArray testing x) (test))
> 	a<-readIOArray testing 0
> 	putStr (decompose a)
> 	
> test::[Lesson]
> test=(replicate 100000 (Lesson "" 1 2 "" ""))
> 
> decompose (Lesson s1 _ _ _ _) = s1
> 
> Greets Ron
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>