Array faster than UArray Double, Was: ...speed of array types

Jan Kybic kybic@ieee.org
23 Jul 2002 11:16:25 +0200


> > Could you try IOUArray for completeness too?  (An IOUArray is the
> > unboxed version of IOArray, it can be found in Data.Array.IO).
> 
> It fits in as the fastest:
> 
>     IOUnboxedMutArray         0.48u 0.04s 0:00.58 89.6%
> 
> > > NormalArray               1.65u 0.20s 0:01.89 97.8%
> > > NormalArrayReplace        2.40u 0.08s 0:02.56 96.8%
> > > UnboxedArray              0.80u 0.04s 0:00.87 96.5%
> > > UnboxedArrayReplace       1.83u 0.07s 0:01.99 95.4%
> > > IOMutArray                0.60u 0.03s 0:01.09 57.7%
> 

Hello. 

I have recently coded in Haskell a little program which evaluates 
a function given as a series of matrix products. Matrices and vectors
are represented as type X. Surprisingly, compiled with 'ghc -O2'
(vers 5.02.2) the program runs faster with X=Array than with X=UArray Double. 
I was quite puzzled by this result, I suppose that maybe the laziness 
helps to avoid memory allocation or something. Is that possible?

I am not posting the program here, because: a) it is somewhat long,
and b) I am a Haskell beginner.  However, if somebody wants to play
with it, I will try to reduce and polish my code and to post it here.

Jan

-- 
-------------------------------------------------------------------------
Jan Kybic <kybic@ieee.org>      Robotvis, INRIA, Sophia-Antipolis, France
       or <Jan.Kybic@sophia.inria.fr>,tel. work +33 492 38 7589, fax 7845
                    http://www-sop.inria.fr/robotvis/personnel/Jan.Kybic/