[mercury-users] Compiler optimization for large number of factual clauses.
Bartlomiej Szymczak
rhywek at gmail.com
Tue Jul 3 00:07:10 AEST 2007
On 7/1/07, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>
> On Fri, 29 Jun 2007, Bartlomiej Szymczak wrote:
>
> > Consider the following Mercury code:
> >
> > :-type c --->
> > c_1;
> > c_2;
> > ....(thousands of entries)
> > c_99999.
> >
> > :-pred rel(c,c).
> > :-mode rel(in,in) is semidet.
> > :-mode rel(in,out) is nondet.
> > :-mode rel(out,in) is nondet.
> >
> > rel(c_1,c_2).
> > rel(c_1,c_3).
> > rel(c_3,c_1).
> > ....(thousands of entries)
> > rel(c_99999,c_3).
> >
> > I want to ask how fast the "rel" predicate is. Will the compiler
> > optimize it by adding some hash table based lookup?
>
> In low-level C grades recent versions of the Mercury compiler (> 0.13.x)
> will compile predicates that consist of facts into code that does table
> lookups. (With version 0.13.x and below you have to use fact tables
> to obtain similar code.)
>
> > Are all three modes equivalently efficient?
>
> The compiler generates the separate code for each mode of a predicate.
> It will attempt to make the code for each mode as efficient as
> possible.
>
> Julien.
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------
>
Thanks!
--
Bartlomiej Antoni Szymczak
--------------------------------------------------------------------------
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