[m-rev.] for review: type specialise bag procedures

Peter Wang novalazy at gmail.com
Fri Feb 29 12:09:45 AEDT 2008


Estimated hours taken: 0.5
Branches: main

Type specialise some bag procedures for variables.  This results in a 1.1%
speedup on neptune.

library/bag.m:
library/svbag.m:
	As above.

[-O5 --intermodule-optimisation]
withchanges 	average of 12 with ignore=1     22.18
withoutchanges 	average of 12 with ignore=1     22.43

Index: library/bag.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bag.m,v
retrieving revision 1.33
diff -u -r1.33 bag.m
--- library/bag.m	26 Nov 2007 02:09:10 -0000	1.33
+++ library/bag.m	29 Feb 2008 00:04:22 -0000
@@ -244,6 +244,26 @@
 
 :- implementation.
 
+% Everything below here is not intended to be part of the public interface,
+% and will not be included in the Mercury library reference manual.
+
+:- interface.
+
+:- import_module term.      % for var/1.
+
+:- pragma type_spec(bag.insert/3, T = var(_)).
+:- pragma type_spec(bag.insert_list/3, T = var(_)).
+:- pragma type_spec(bag.insert_set/3, T = var(_)).
+
+:- pragma type_spec(bag.remove/3, T = var(_)).
+:- pragma type_spec(bag.remove_list/3, T = var(_)).
+:- pragma type_spec(bag.det_remove_list/3, T = var(_)).
+:- pragma type_spec(bag.det_remove_set/3, T = var(_)).
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+
 :- import_module int.
 :- import_module map.
 :- import_module pair.
Index: library/svbag.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svbag.m,v
retrieving revision 1.7
diff -u -r1.7 svbag.m
--- library/svbag.m	6 Mar 2007 05:48:34 -0000	1.7
+++ library/svbag.m	29 Feb 2008 00:04:22 -0000
@@ -109,6 +109,21 @@
 
 :- implementation.
 
+% Everything below here is not intended to be part of the public interface,
+% and will not be included in the Mercury library reference manual.
+
+:- interface.
+
+:- import_module term.      % for var/1.
+
+:- pragma type_spec(svbag.insert_set/3, T = var(_)).
+
+:- pragma type_spec(svbag.det_remove_set/3, T = var(_)).
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+
 svbag.insert(Item, Bag0, Bag) :-
     bag.insert(Bag0, Item, Bag).
 


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