This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/benchmarks/SCRIPT

88 lines
2.5 KiB
Plaintext
Raw Normal View History

=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.22.5
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(benchmarks(loader)).
...
% call the predicate my_length/0 defined in the Prolog database:
| ?- benchmark(my_length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _)).
Number of repetitions: 100000
Loop time: 0.04 seconds
Goal time: 0.31 seconds
Average time per call: 2.7e-06 seconds
Number of calls per second: 370370.370370371
yes
% call the predicate module:mod_length/2 from top-level:
| ?- benchmark(module:mod_length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _)).
Number of repetitions: 100000
Loop time: 0.04 seconds
Goal time: 0.31 seconds
Average time per call: 2.7e-06 seconds
Number of calls per second: 370370.37037037
yes
% call the predicate list::length/2 from top-level:
| ?- benchmark(object::length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _)).
Number of repetitions: 100000
Loop time: 0.0600000000000005 seconds
Goal time: 0.94 seconds
Average time per call: 8.79999999999999e-06 seconds
Number of calls per second: 113636.363636364
yes
% compiled call of the predicate list::length/2 (simulates message sending
% from a compiled object to another object; thus no top-level overhead):
| ?- benchmark('$lgt_send_to_object_nv'(object, length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _), user)).
Number of repetitions: 100000
Loop time: 0.0499999999999972 seconds
Goal time: 0.510000000000002 seconds
Average time per call: 4.60000000000004e-06 seconds
Number of calls per second: 217391.304347824
yes
% compiled call of the predicate list::length/2 (simulates message sending
% from a compiled object to another object with event-driven programming
% support switched off and with no top-level overhead):
| ?- benchmark('$lgt_send_to_object_ne_nv'(object, length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _), user)).
Number of repetitions: 100000
Loop time: 0.0500000000000007 seconds
Goal time: 0.43 seconds
Average time per call: 3.79999999999999e-06 seconds
Number of calls per second: 263157.894736843
yes
% create and abolish an elementary dynamic object:
| ?- benchmark((create_object(xpto, [], [], []), abolish_object(xpto))).
Number of repetitions: 100000
Loop time: 0.039999999999992 seconds
Goal time: 102.77 seconds
Average time per call: 0.0010273 seconds
Number of calls per second: 973.425484279178
yes