I've written a program to process a large amount of data samples using Repa. Performance is key for this program. A large part of the operations require parallel maps/folds over a multi-dimensional arrays and Repa
is perfect for this. However, there is still a part of my program that only uses one-dimensional arrays and doesn't require parallelism (i.e. overhead of parallelism would harm performance). Some of these operations require functions like take
or fold
s with custom accumulators, which Repa
doesn't support. So I'm writing these operations myself by iterating over the Repa
array.
Am I better off re-writing these operations by using Vector instead of Repa
? Would they result in better performance?
I've read somewhere that one-dimensional Repa
arrays are implemented as Vector
s 'under the hood' so I doubt that Vector
s result in better performance. On the other hand, Vector
does have some nice built-in functions that I could use instead of writing them myself.
I've implemented some parts of my program with Data.Vector.Unboxed
instead of using one-dimensional Data.Array.Repa
. Except for some minor improvements, the algorithms are the same. Data.Vector.Unboxed
seems to be 4 times faster than one-dimensional Data.Array.Repa
for sequential operations.