[m-rev.] diff: debugger/fib
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Mar 9 14:57:38 AEDT 2005
tests/debugger/fib.{m,exp}:
Make this test independent of timing.
Zoltan.
cvs diff: Diffing .
Index: fib.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/fib.exp,v
retrieving revision 1.1
diff -u -b -r1.1 fib.exp
--- fib.exp 7 Mar 2005 05:00:35 -0000 1.1
+++ fib.exp 9 Mar 2005 03:12:12 -0000
@@ -1,14 +1,14 @@
- E1: C1 CALL pred fib.main/2-0 (cc_multi) fib.m:13
+ E1: C1 CALL pred fib.main/2-0 (det) fib.m:13
mdb> echo on
Command echo enabled.
mdb> context none
Contexts will not be printed.
mdb> register --quiet
mdb> step
- E2: C2 CALL pred fib.perform_trials/3-0 (cc_multi)
+ E2: C2 CALL pred fib.perform_trial/3-0 (det)
mdb> finish
-tabling works
- E3: C2 EXIT pred fib.perform_trials/3-0 (cc_multi)
+got same results
+ E3: C2 EXIT pred fib.perform_trial/3-0 (det)
mdb> table mfib
memo table for pred fib.mfib/2-0 (det):
<0>: succeeded <1>
@@ -35,14 +35,11 @@
<21>: succeeded <17711>
<22>: succeeded <28657>
<23>: succeeded <46368>
-<24>: succeeded <75025>
-<25>: succeeded <121393>
-<26>: succeeded <196418>
-end of table (27 entries)
+end of table (24 entries)
mdb> step 2
E4: C3 EXIT pred fib.reset/2-0 (det)
mdb> table mfib
memo table for pred fib.mfib/2-0 (det):
end of table (0 entries)
mdb> continue
-tabling works
+got same results
Index: fib.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/fib.m,v
retrieving revision 1.1
diff -u -b -r1.1 fib.m
--- fib.m 7 Mar 2005 05:00:35 -0000 1.1
+++ fib.m 9 Mar 2005 02:12:39 -0000
@@ -4,46 +4,22 @@
:- import_module io.
-:- pred main(io::di, io::uo) is cc_multi.
+:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module benchmarking, require, int.
main(!IO) :-
- perform_trials(20, !IO),
+ perform_trial(23, !IO),
reset(!IO),
- perform_trials(20, !IO).
+ perform_trial(23, !IO).
-:- pred perform_trials(int::in, io::di, io::uo) is cc_multi.
+:- pred perform_trial(int::in, io::di, io::uo) is det.
-perform_trials(N, !IO) :-
- trial(N, Time, MTime),
- % io__write_int(N, !IO),
- % io__write_string(": ", !IO),
- % io__write_int(Time, !IO),
- % io__write_string("ms vs ", !IO),
- % io__write_int(MTime, !IO),
- % io__write_string("ms\n", !IO),
- (
- (
- Time > 10 * MTime,
- MTime > 0 % untabled takes ten times as long
- ;
- Time > 100, % untabled takes at least 100 ms
- MTime < 1 % while tabled takes at most 1 ms
- )
- ->
- io__write_string("tabling works\n", !IO)
- ;
- Time > 10000 % Untabled takes at least 10 seconds
- ->
- io__write_string("tabling does not appear to work\n", !IO)
- ;
- % We couldn't get a measurable result with N,
- % and it looks like we can afford a bigger trial
- perform_trials(N+3, !IO)
- ).
+perform_trial(N, !IO) :-
+ trial(N, _Time, _MTime),
+ io__write_string("got same results\n", !IO).
:- pred trial(int::in, int::out, int::out) is cc_multi.
cvs diff: Diffing declarative
--------------------------------------------------------------------------
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