[mercury-users] version_array vs. field update performance
Ben Schmidt
b.schmidt at ugrad.unimelb.edu.au
Tue Feb 6 18:39:38 AEDT 2007
I don't suppose you will see much performance difference unless your
vectors are quite large, which I presume they're not if a tuple is a
suitable alternative representation. Updating the array and the trail
will not be all that much faster than copying a tuple unless the data
structure is big--possibly even not unless it's bigger than a cache
block. An unversioned array may be faster, even for smaller structures,
if that suits your application, as that doesn't need to record its
changes for backtracking.
Ben.
Ondrej Bojar wrote:
> Hi,
>
> I'm working with many vectors of floats, all of a fixed length. I create
> lots of them, then stepwise set and update some of the fields and sort
> them according to a scalar product with a constant "weights" vector.
>
> Currently I use version_array to store each vector.
>
> About 7% of run time is used on 'version_array.elem :=', and another 6%
> is used on 'version_array.elem'.
>
> Given that the vector length is fixed, I could use tuples or data terms
> with field access functions to get or update vector components.
>
> In a small test, I tried to compared the performance of each of the
> representations and I was surprised to see that there is nearly no speed
> difference observable. Would this be what you expect? I was hoping to
> see there is less overhead in the field update routines.
>
> Can arrays (with the di/uo workaround hassle) be faster?
>
> Or should I be just satisfied with the 7million field updates per second
> I get on my Intel(R) Pentium(R) M processor 1500MHz?
>
> Thanks, Ondrej.
> --------------------------------------------------------------------------
> mercury-users mailing list
> Post messages to: mercury-users at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
> Subscriptions: mercury-users-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------
>
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list