File: SCRIPT

package info (click to toggle)
yap 5.1.1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 16,124 kB
  • ctags: 14,650
  • sloc: ansic: 122,796; perl: 22,545; sh: 3,768; java: 1,277; makefile: 1,191; xml: 739; tcl: 624; lisp: 142; awk: 9
file content (136 lines) | stat: -rw-r--r-- 3,976 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.27.1

Copyright (c) 1998-2006 Paulo Moura.  All Rights Reserved.
=================================================================


% start by loading the example:

| ?- logtalk_load(benchmarks(loader)).
...


% run the default set of benchmark tests:

| ?- benchmarks.
...


% or run specific benchmark tests individually as exemplified next...


% call the predicate my_length/0 defined in the Prolog database:

| ?- generate_list(30, List), benchmark(my_length(List, _)).

Number of repetitions: 100000
Loop time: 0.03 seconds
Goal time: 0.39 seconds
Average time per call: 3.6e-06 seconds
Number of calls per second: 277777.777777778
List = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] ? 
yes


% call the predicate object::length/2 from the top-level:

| ?- generate_list(30, List), benchmark(object::length(List, _)).

Number of repetitions: 100000
Loop time: 0.04 seconds
Goal time: 0.79 seconds
Average time per call: 7.5e-06 seconds
Number of calls per second: 133333.333333333
List = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] ? 
yes


% compiled call of the predicate object::length/2 (simulates message sending 
% from a compiled object to another object; thus with no top-level overhead):

| ?- generate_list(30, List), benchmark('$lgt_send_to_object_nv'(object, length(List, _), user)).

Number of repetitions: 100000
Loop time: 0.0299999999999998 seconds
Goal time: 0.5 seconds
Average time per call: 4.70000000000001e-06 seconds
Number of calls per second: 212765.957446808
List = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] ? 
yes


% compiled call of the predicate object::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):

| ?- generate_list(30, List), benchmark('$lgt_send_to_object_ne_nv'(object, length(List, _), user)).

Number of repetitions: 100000
Loop time: 0.0300000000000002 seconds
Goal time: 0.46 seconds
Average time per call: 4.3e-06 seconds
Number of calls per second: 232558.139534884
List = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] ? 
yes


% create and abolish an elementary dynamic object:

| ?- benchmark((create_object(xpto, [], [], []), abolish_object(xpto))).

Number of repetitions: 100000
Loop time: 0.0300000000000011 seconds
Goal time: 51.59 seconds
Average time per call: 0.0005156 seconds
Number of calls per second: 1939.48797517455
yes


% test assertz/1 and retract/1 performance in plain Prolog:

| ?- benchmark(db_test_plain).

Number of repetitions: 100000
Loop time: 0.0299999999999727 seconds
Goal time: 51.07 seconds
Average time per call: 0.0005104 seconds
Number of calls per second: 1959.24764890282
yes


% test assertz/1 and retract/1 performance on "this" database:

| ?- benchmark('$lgt_send_to_object_ne_nv'(database, db_test_this, user)).

Number of repetitions: 100000
Loop time: 0.0299999999999727 seconds
Goal time: 63.37 seconds
Average time per call: 0.0006334 seconds
Number of calls per second: 1578.78118092832
yes


% test assertz/1 and retract/1 performance on "self" database:

| ?- benchmark('$lgt_send_to_object_ne_nv'(database, db_test_self, user)).

Number of repetitions: 100000
Loop time: 0.0299999999999727 seconds
Goal time: 71.3499999999999 seconds
Average time per call: 0.000713199999999999 seconds
Number of calls per second: 1402.13123948402
yes


% test assertz/1 and retract/1 performance on another object database (using ::/2):

| ?- benchmark('$lgt_send_to_object_ne_nv'(database, db_test_obj, user)).

Number of repetitions: 100000
Loop time: 0.0299999999999727 seconds
Goal time: 68.97 seconds
Average time per call: 0.0006894 seconds
Number of calls per second: 1450.53669857847
yes