[m-rev.] for review: dead_pred_elim optimization

Peter Ross pro at missioncriticalit.com
Thu Mar 6 20:10:31 AEDT 2003


On Thu, Mar 06, 2003 at 04:17:37PM +1100, Simon Taylor wrote:
> On 05-Mar-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > Estimated hours taken: 4
> > Branches: main
> > 
> > Fix a performance bug where dead_pred_elim was taking a significant
> > amount of time to delete entries from the predicate_table.  With this
> > change dead_pred_elim goes from 12 minutes to 55 seconds CPU time in
> > the IL grade when compiling accumulator.m with
> > --intermodule-optimization turned on.
>  
> > Index: compiler/hlds_module.m
> > ===================================================================
> > @@ -1756,22 +1765,45 @@
> >  
> >  %-----------------------------------------------------------------------------%
> >  
> > +predicate_table_restrict(OrigPredicateTable, PredIds, PredicateTable) :-
> > +	predicate_table_reset(OrigPredicateTable, PredicateTable0),
> > +	predicate_table_get_preds(OrigPredicateTable, Preds),
> > +	PredicateTable = list__foldl(
> > +			(func(PredId, Table0) = Table :-
> > +				PredInfo = map__lookup(Preds, PredId),
> > +				predicate_table_insert_2(Table0,
> > +						yes(PredId), PredInfo,
> > +						must_be_qualified,
> > +						no, _, Table)
> > +				
> > +			), PredIds, PredicateTable0).
> 
> The `must_be_qualified' here looks wrong.
> 
On second thoughts, I think you are right, I have changed it to
may_be_unqualified.

> Surely there is a more space efficient algorithm to build a 234 tree
> (other than repeated insertion) when you have a sorted list of entries?
> 
Yes I am sure that there is, but only one of the 7 maps will be inserted
into in a sorted order, so I don't think the effect would be
significant.

Pete
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list