[mercury-users] Converting large tables from prolog

Richard Tucker rit at cam.sri.com
Fri Nov 26 02:37:27 AEDT 1999


Hello from a new Mercury user!

I have a prolog program involving a large table of around 50000
facts of the form: foo(string, list(pair(tag, float))). In prolog
this is no problem: I just consult a file with them in, and if
that takes too long I can save an image, which is then quite quick
to load.

I wanted to try converting this to Mercury. Once the table is built,
I don't need to add or remove entries, and I only ever want to use
the mode foo(in, out), so it seems a map would be the obvious choice.
I tried having the program build a map at by reading in all the facts
from a file, but this is very slow -- it takes around 25 seconds on
an ultrasparc, and it has to do it every time it starts up. I also
tried getting the Mercury compiler to compile all 50000 clauses for
the predicate foo, but it eventually ran out of memory. Lastly, I
tried building a map from a file, then writing it out and attempting
to read it back in again. This caused the detstack to overflow,
and if I increase detstack-size then it runs out of memory.

So, what's the recommended thing to do?

Richard/

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