On Sun, May 13, 2012 at 9:20 PM, David Nolen <dnolen.lists(a)gmail.com> wrote:
How do people run simple timing tests in Ciao? In SWI-Prolog I can do the following:
benchmark1 :- flag(benchmark,_,0), repeat, zebra1(Houses, WaterDrinker, ZebraOwner), flag(benchmark,N,N+1), N = 1000, !. benchmark :- time(benchmark1).
What is the equivalent in Ciao?
Dear David,
there is no equivalent in Ciao for SWI time/1, but you can program it, e.g.:
:- meta_predicate time(goal). time(G) :- statistics(runtime, [T0|_]), G, statistics(runtime, [T1|_]), T is T1 - T0, write('time: '), write(T), nl.
The main reason why Ciao lacks this predicate is that, when doing extensive benchmarking, you need something more sophisticated than time/1. We could add it if there is enough interest. However, I think that something similar to 'benchmark.js' (used in jsperf.com) would be nicer.
Cheers