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 8b74eb8b2b Logtalk 2.23.1 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1260 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2005-03-06 21:19:09 +00:00

128 lines
3.6 KiB
Plaintext

=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.23.1
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
% test assertz/1 and retract/1 performance in plain Prolog:
| ?- benchmark(db_test_plain).
Number of repetitions: 100000
Loop time: 0.0599999999999454 seconds
Goal time: 81.25 seconds
Average time per call: 0.000811900000000001 seconds
Number of calls per second: 1231.67877817465
% test assertz/1 and retract/1 performance in this:
| ?- benchmark('$lgt_send_to_object_ne_nv'(database, db_test_this, user)).
Number of repetitions: 100000
Loop time: 0.0699999999999363 seconds
Goal time: 92.03 seconds
Average time per call: 0.0009196 seconds
Number of calls per second: 1087.42931709439
% test assertz/1 and retract/1 performance in self:
| ?- benchmark('$lgt_send_to_object_ne_nv'(database, db_test_self, user)).
Number of repetitions: 100000
Loop time: 0.0599999999999454 seconds
Goal time: 111.92 seconds
Average time per call: 0.0011186 seconds
Number of calls per second: 893.974611121043
% test assertz/1 and retract/1 performance using ::/2:
| ?- benchmark('$lgt_send_to_object_ne_nv'(database, db_test_obj, user)).
Number of repetitions: 100000
Loop time: 0.0600000000001728 seconds
Goal time: 114.37 seconds
Average time per call: 0.0011431 seconds
Number of calls per second: 874.814102003327