/* running van Roy benchmarks in Picat v3. This is based on my Picat version: http://hakank.org/picat/bench.pi Note: The following bencmarks are not ported yet: - chat_parser - simple_analyzer - pingpong This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ main => go. % % "Standard" benchmark instances and repetitions % without chat_parser, simple_analyzer, and ping pong % Total 8.76s % % """ % boyer_v3 100: time: 779ms % browse_v3 100: time: 1000ms % crypt_v3 10000: time: 2342ms % fast_mu_v3 10000: time: 136ms % flatten_v3 10000: time: 99ms % meta_qsort_v3 500: time: 56ms % mu_v3 10000: time: 369ms % nand_v3 1000: time: 277ms % nreverse_v3 10000: time: 86ms % poly_10_v3 1000: time: 525ms % prover_v3 10000: time: 146ms % qsort_v3 10000: time: 65ms % queens_8_v3 500: time: 732ms % query_v3 1500: time: 71ms % reducer_v3 500: time: 669ms % sdda_v3 10000: time: 68ms % sendmore_v3 500: time: 439ms % tak_v3 500: time: 546ms % zebra_v3 500: time: 354ms % % Total: 8.75900s (8759ms) % """ % go ?=> time(bench1), nl. go => true. % % The SWI Prolog instances and reps: total 2.76s % % This Picat program: % """ % boyer_v3 8: time: 66ms % browse_v3 7: time: 68ms % crypt_v3 868: time: 201ms % fast_mu_v3 4819: time: 69ms % flatten_v3 8275: time: 87ms % meta_qsort_v3 966: time: 343ms % mu_v3 6827: time: 70ms % nreverse_v3 11378: time: 119ms % poly_10_v3 105: time: 51ms % prover_v3 6400: time: 91ms % qsort_v3 8445: time: 91ms % queens_8_v3 63: time: 92ms % query_v3 1219: time: 57ms % reducer_v3 164: time: 106ms % sendmore_v3 44: time: 40ms % tak_v3 35: time: 38ms % zebra_v3 166: time: 117ms % sieve_v3 16: time: 1005ms % queens_clpfd_v3 1: time: 2ms % fib_v3 70: time: 51ms % % Total: 2.76400s (2764ms) % """ % % As a comparison: % Running SWI-Prolog with the these benchmarks commented out % (since they have not been ported to Picat yet): % - chat_parser % - simple_analyzer % - pingpong % % Total: 6.3s % """ % 'Program' Time GC % ================================ % boyer 0.168 0.010 % browse 0.228 0.000 % crypt 0.280 0.000 % fast_mu 0.301 0.000 % flatten 0.271 0.000 % meta_qsort 0.243 0.000 % mu 0.303 0.000 % nreverse 0.203 0.000 % poly_10 0.266 0.000 % prover 0.321 0.000 % qsort 0.331 0.000 % queens_8 0.291 0.000 % query 0.313 0.000 % reducer 0.320 0.000 % sendmore 0.395 0.000 % tak 0.333 0.000 % zebra 0.297 0.000 % sieve 0.346 0.000 % queens_clpfd 0.357 0.045 % fib 0.404 0.000 % average 0.299 0.003 % swipl -f run.pl 6,11s user 0,06s system 98% cpu 6,269 total % """ % go2 ?=> time(bench2), nl. go2 => true. bench1 => Total = 0, programs(Programs), foreach($(Program, Runs) in Programs) % garbage_collect(300_000_000), statistics(runtime,_), bench_program(Program,Runs), statistics(runtime,[_,Time]), printf("time: %dms\n", Time), Total := Total + Time end, printf("\nTotal: %5.5fs (%dms)\n", Total/1000.0, Total), nl. % With SWI Prolog bench times bench2 => Total = 0, programs_swi(Programs), foreach($(Program, Runs) in Programs) % garbage_collect(300_000_000), statistics(runtime,_), bench_program(Program,Runs), statistics(runtime,[_,Time]), printf("time: %dms\n", Time), Total := Total + Time end, printf("\nTotal: %5.5fs (%dms)\n", Total/1000.0, Total), nl. % Note: We run the top/0 predicate on the benchmarks. % They should not output anything. bench_program(Program, Runs) => printf("%w %d: ", Program, Runs), if Runs > 0 then cl(Program), foreach(_I in 1..Runs) call(top) end end. % The times are from % http://www.jekejeke.ch/idatab/doclet/prod/en/docs/05_run/15_stdy/06_bench/08_harness/01_common/01_common.p.html programs( [(boyer_v3,100), (browse_v3,100), % (chat_parser_v3,500), % not ported (crypt_v3,10000), (fast_mu_v3,10000), (flatten_v3,10000), (meta_qsort_v3,500), (mu_v3,10000), (nand_v3,1000), (nreverse_v3,10000), (poly_10_v3,1000), (prover_v3,10000), (qsort_v3,10000), (queens_8_v3,500), (query_v3,1500), (reducer_v3,500), (sdda_v3,10000), (sendmore_v3,500), % (simple_analyzer_v3,500), % not ported (tak_v3,500), % (unify_v3,20000), % not ported (zebra_v3,500)]). % % These time and instances are from the SWI-Prolog program % https://github.com/SWI-Prolog/bench/run.pl % programs_swi([ (boyer_v3, 8), (browse_v3, 7), % (chat_parser_v3, 46), % not ported (crypt_v3, 868), (fast_mu_v3, 4819), (flatten_v3, 8275), (meta_qsort_v3, 966), (mu_v3, 6827), (nreverse_v3, 11378), (poly_10_v3, 105), (prover_v3, 6400), (qsort_v3, 8445), (queens_8_v3, 63), (query_v3, 1219), (reducer_v3, 164), (sendmore_v3, 44), % (simple_analyzer_v3, 320), % not ported (tak_v3, 35), (zebra_v3, 166), % Later additions (sieve_v3, 16), (queens_clpfd_v3, 1), % (pingpong_v3, 8), % not ported (fib_v3, 70) ]).