[Haskell-cafe] poor perfomance of indexU in uvector package

Alexey Khudyakov alexey.skladnoy at gmail.com
Mon Nov 16 06:46:57 EST 2009


On Sun, Nov 15, 2009 at 8:59 PM, Don Stewart <dons at galois.com> wrote:
> alexey.skladnoy:
>> I found that perfomace of indexU is very poor and it is not fast O(1)
>> operation which is very surprising. Here is some benchmarcking I've
>> done. Everything compiled with -O2
>
> You're using the streamed version when its not fusing. Use the
> non-streaming direct implementation exported from Data.Array.Vector.UArr
>
> This is really an API bug, but I've not had time to sanitize the use.
>
Probably this should be stated more explicitly in documentation. This is
_very_ unexpected and confusing behaviour.

Also I don't quite understand nature of bug. Is this missing export or
wrong function is exported. And is streamed version of idexU useful
 and in which way?


On Sun, Nov 15, 2009 at 9:11 PM, Thomas DuBuisson
<thomas.dubuisson at gmail.com> wrote:
> The documentation explicitly says indexU is O(n) - no need for so much
> testing to rediscover that fact.  When I needed a contiguous block of
> values in UArr, I just relied on sliceU to acquire the block and
> performed a foldU.
>
Problems begin when you need non-contiguous block. Easiest way to so
is indexing.


More information about the Haskell-Cafe mailing list