[mercury-users] cost/benefit analysis of non-determinism in Mercury

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Jan 28 13:36:38 AEDT 2004


On 28-Jan-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> $ grep ':- mode.*is multi' ~/mercury/mercury/compiler/*.m | wc -l
>      14
> $ grep ':- mode.*is nondet' ~/mercury/mercury/compiler/*.m | wc -l
>      55

Our source_stats.awk script finds a few more nondet predicates, because
it uses a more general search pattern. Here is its output:

	Number of types:                  1540
	Number of insts:                    74
	Number of predicates:             8770
	Number of functions:              1122

	Number of predmodes:              5848
	Number of funcmodes:                11
	Number of separate modes:         2925
	Number of implicit function modes:    ?
	Total number of modes:       >=   8784
				     =<   9906
		- det:                    8148 ( 92.76%)
		- semidet:                1330 ( 15.14%)
		- nondet:                  102 (  1.16%)
		- multi:                    14 (  0.16%)
		- cc_nondet:                 1 (  0.01%)
		- cc_multi:                  9 (  0.10%)
		- erroneous:                 5 (  0.06%)
		- failure:                   0 (  0.00%)
	Average modes per predicate: >=  1.000
				     =<  1.002

	Blank lines:                     44030 ( 15.77%)
	Comment lines:                   41213 ( 14.76%)
	Total whitespace/comment lines:  85243 ( 30.53%)

	Function declaration lines:       1387 (  0.50%)
	Predicate declaration lines:     17922 (  6.42%)
	Mode declaration lines:           3175 (  1.14%)
	Type declaration lines:           7596 (  2.72%)
	Inst declaration lines:            237 (  0.08%)
	Other declaration lines:          5761 (  2.06%)
	Total declaration lines:         36078 ( 12.92%)

	Code lines:                     157932 ( 56.56%)

	Total number of lines:          279253 (100.00%)

Supporting nondeterministic code in the code generators is not that hard
if you don't want the last ounce of performance, and in any case it is done.
Same for the debugger and the profilers. Supporting nondeterministic
procedures written in C does pose some problems, because at the moment they
are handled directly by the code generators. However, we have a design for
translating them into pieces of deterministic C code and nondeterministic
Mercury glue, which would eliminate the problems.

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



More information about the users mailing list