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
pmoura 5f5589e8de Logtalk 2.21.6 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1175 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2004-11-16 19:37:30 +00:00

88 lines
2.4 KiB
Plaintext

=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.21.6
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(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