bench :- counter_init, count_to(X), statistics(walltime,_), bench_assert(X), statistics(walltime,[_,TimeA]), bench_c(X), statistics(walltime,[_,TimeC]), format('Counting to: ~w.~nAssert/Retract: ~w~nC-Based: ~w~n', [X,TimeA,TimeC]).
Calls:
Name: format/2
Name: statistics/2
Name: bench_c/1
Name: bench_assert/1
Name: count_to/1
Name: counter_init
bench_assert(X) :- assert(count(0)), bench_assert_aux(X).
Name: bench_assert_aux/1
Name: count/1
Name: assert/1
Called:
Name: bench/0
bench_assert_aux(X) :- retract(count(C)), C < X, NC is C + 1, assert(count(NC)), bench_assert_aux(X). bench_assert_aux(_).
Name: RECURSIVE_CALL/1
Name: is/2
Name: </2
Name: retract/1
bench_c(X) :- new_counter('my_counter'), bench_c_aux('my_counter',X).
Name: bench_c_aux/2
Name: new_counter/1
bench_c_aux('my_counter',X) :- inc_counter('my_counter',C), C < X, bench_c_aux('my_counter',X). bench_c_aux(_,_).
Name: RECURSIVE_CALL/2
Name: inc_counter/2
count_to(1000000).