[m-dev.] for review: performance improvements to moose.

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 24 15:56:47 AEST 2000


On 23-Aug-2000, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> 
> extras/moose/grammar.m:
> extras/moose/lalr.m:
> 	Changed a couple of places where list_to_set is called so that
> 	we construct the list in sorted order and can call
> 	sorted_list_to_set instead which give about a 10% performance
> 	improvement.
> 
> 	Change a place where we call set_to_sorted_list and then iterate
> 	over the list calling set__insert. Instead we now reverse the
> 	list first so that the insertions happen at the start of the list
> 	not the end. Results in about 5% performance improvement.
> 
> Index: grammar.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/extras/moose/grammar.m,v
> retrieving revision 1.1
> diff -u -r1.1 grammar.m
> --- grammar.m	2000/05/22 05:22:03	1.1
> +++ grammar.m	2000/08/23 04:50:32
> @@ -229,7 +229,15 @@
>  		First0, Follow0),
>  	foldl(transform_clause_list, ClauseList, Grammar0, Grammar1),
>  	compute_first0(Grammar1, Grammar2),
> -	compute_follow0(Grammar2, Grammar).
> +	compute_follow0(Grammar2, Grammar3),
> +	Grammar3 = grammar(Rules3, AllClauses3, XForms3, Nont3, ClauseIndex3,
> +		First3, Follow3),
> +	map__map_values((pred(_K::in, V0::in, V::out) is det :-
> +	    sort(V0, V1),
> +	    reverse(V1, V)
> +	), ClauseIndex3, ClauseIndex4),
> +	Grammar = grammar(Rules3, AllClauses3, XForms3, Nont3, ClauseIndex4,
> +		First3, Follow3).

A comment here would probably be a good idea...

Apart from that, this looks fine.

-- 
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-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list