1

I have a prolog program of which I'm trying to do some analysis and establish the runtime. As time/1 gives the values in seconds, I'm just getting 0 recorded as it is not fine grain enough.

My plan to get around this is to run my Prolog program say 1000 times, find the runtime of this then simply divide by 1000 to give the runtime of the actual program. How do you run a prolog program multiple times to have this effect?

false
  • 10,264
  • 13
  • 101
  • 209
Toby Cannon
  • 725
  • 6
  • 16
  • Look at the following related question... and the proposed answers, too ;-) https://stackoverflow.com/questions/34970061/display-the-execution-times-for-each-goal-of-a-predicate-clause/35015088 – repeat Mar 05 '18 at 00:15

1 Answers1

4

Use for example:

?- between(1, 1 000, _),
   your_goal,
   false.
mat
  • 40,498
  • 3
  • 51
  • 78
  • It definitely does run the goal in the middle! To estimate the running time of your goal, compute the difference with and without the goal, and maybe try a larger number of iterations. – mat Mar 04 '18 at 08:44