[m-rev.] for post-commit review: make zm_eq20.m compile in 2.5s (hlc.gc)

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Sep 21 15:54:04 AEST 2009


On 21-Sep-2009, Mark Brown <mark at csse.unimelb.edu.au> wrote:
> > +filter_constraint_map([], !RevVarConstraints, !TCIMap, _VarUses).
> > +filter_constraint_map([VarConstraint | VarConstraints], !RevVarConstraints,
> > +        !TCIMap, VarUses) :-
> > +    VarConstraint = Var - Constraint,
> > +    VarNum = var_to_int(Var),
> > +    array.unsafe_lookup(VarUses, VarNum, Used),
> > +    (
> > +        Used = yes,
> > +        !:RevVarConstraints = [VarConstraint | !.RevVarConstraints]
> > +    ;
> > +        Used = no,
> > +        map.delete(!.TCIMap, Constraint, !:TCIMap)
> 
> This seems the hard way to do it.  Why not filter this map via an assoc_list
> as is done with the others?  In the worst case behaviour that we had, this
> map would have been quite small and it would be better to filter it directly
> rather than delete lots of keys that mostly won't be there.

It seemed the easy way to me, since it doesn't require any code to match
the shapes of the VarConstraint list (which is ordered on Var) and the TCIMap
(which is keyed on Constraint).

If you want to try to make it more efficient, go ahead, but measure it.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list