[mercury-users] version_array vs. field update performance

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Feb 6 18:49:25 AEDT 2007

On Tue, 6 Feb 2007, Ondrej Bojar wrote:

> 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?

Ralph posted some comparison benchmarks when he originally implemented
version data structures.  See the following thread on


There have been a couple of changes to their implementation since then
but I don't know what affect, if any, that would have had.

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