[mercury-users] Re: (the lack of) unique modes

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 5 16:28:37 AEDT 1999


On 05-Nov-1999, Tomas By <tomas at research.nj.nec.com> wrote:
> Fergus Henderson writes:
> > Yes, unique modes would probably help.  If all of those map(int, ...)
> > are dense, then you could use arrays rather than maps.  That would
> > probably help a lot.
> 
> No, they're not dense...

In that case, you could use hash tables.

> Do you think poymorphism is the/a major problem? Rather than not using
> unique modes?

Check the time spent in compare/3 in the time profile.
That will give an indication of the cost.
In versions prior to the latest development versions,
compare/3 just dispatched to the type-specific comparison
function, so the time spent in compare/3 itself was
entirely overheads of polymorphism.

At a guess I'd estimate it at around 10% for applications like
yours and the Mercury compiler itself, which both use maps heavily.
So it's an issue, but probably not a major one.

Using unique modes with compiler-supported structure reuse would 
probably give you a significant improvement.  Using unique modes
and also changing data structures, e.g. using hash tables instead
of 234-trees, would probably give you a major improvement.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list