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 bc194d7fcc Logtalk 2.21.4 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1166 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2004-10-26 20:59:29 +00:00

65 lines
1.6 KiB
Plaintext

=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.21.4
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% call the built-in control construct true/0 to measure the overhead of the
% benchmark/1 predicate itself:
| ?- benchmark(true).
Number of repetitions: 1000000
Average time per call: 5.1e-07 seconds
Number of calls per second: 1960784.31372549
yes
% 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: 1000000
Average time per call: 3.07e-06 seconds
Number of calls per second: 325732.899022801
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: 1000000
Average time per call: 3.17e-06 seconds
Number of calls per second: 315457.413249211
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: 1000000
Average time per call: 9.14e-06 seconds
Number of calls per second: 109409.190371991
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: 1000000
Average time per call: 5.1e-06 seconds
Number of calls per second: 196078.431372549
yes