2004-10-25 12:13:58 +01:00
|
|
|
=================================================================
|
|
|
|
Logtalk - Object oriented extension to Prolog
|
2005-02-10 00:02:06 +00:00
|
|
|
Release 2.22.5
|
2004-10-25 12:13:58 +01:00
|
|
|
|
2005-01-13 12:22:42 +00:00
|
|
|
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
|
2004-10-25 12:13:58 +01:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
|
|
|
|
% start by loading the example:
|
|
|
|
|
2004-11-29 20:36:31 +00:00
|
|
|
| ?- logtalk_load(benchmarks(loader)).
|
2004-10-25 12:13:58 +01:00
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
% call the predicate my_length/0 defined in the Prolog database:
|
|
|
|
|
|
|
|
| ?- benchmark(my_length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _)).
|
|
|
|
|
2004-11-03 00:13:01 +00:00
|
|
|
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
|
2004-10-25 12:13:58 +01:00
|
|
|
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], _)).
|
|
|
|
|
2004-11-03 00:13:01 +00:00
|
|
|
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
|
2004-10-25 12:13:58 +01:00
|
|
|
yes
|
|
|
|
|
|
|
|
|
|
|
|
% call the predicate list::length/2 from top-level:
|
|
|
|
|
|
|
|
| ?- benchmark(object::length([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], _)).
|
|
|
|
|
2004-11-03 00:13:01 +00:00
|
|
|
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
|
2004-10-25 12:13:58 +01:00
|
|
|
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)).
|
|
|
|
|
2004-11-03 00:13:01 +00:00
|
|
|
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
|
2004-10-25 12:13:58 +01:00
|
|
|
yes
|