Logtalk 2.23.1 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1260 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.23.0
|
||||
Release 2.23.1
|
||||
|
||||
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
@@ -24,13 +24,19 @@ This example is made of four source files:
|
||||
benchmark.pl
|
||||
contains the benchmark predicates
|
||||
plain.pl
|
||||
contains a definition for a list length predicate
|
||||
contains a definition for a list length predicate and a predicate
|
||||
for testing performance of the built-in predicates assertz/1 and
|
||||
retract/1
|
||||
module.pl
|
||||
contains the same definition of a list length predicate
|
||||
encapsulated in a module
|
||||
object.lgt
|
||||
contains the same definition of a list length predicate
|
||||
encapsulated in an object
|
||||
database.lgt
|
||||
contains predicates for testing the performance of the built-in
|
||||
database methods assertz/1 and retract/1
|
||||
|
||||
|
||||
The Prolog files above are loaded (from the loader.lgt file) by using
|
||||
ensure_loaded/1 directives. If this directive is not supported on your
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.23.0
|
||||
Release 2.23.1
|
||||
|
||||
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
@@ -85,3 +85,43 @@ 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
|
||||
|
40
Logtalk/examples/benchmarks/database.lgt
Normal file
40
Logtalk/examples/benchmarks/database.lgt
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
:- object(database).
|
||||
|
||||
:- public(db_test_this/0, db_test_self/0, db_test_obj/0).
|
||||
|
||||
:- private(pred_this/0, pred_self/0, pred_obj/0).
|
||||
:- dynamic(pred_this/0, pred_self/0, pred_obj/0).
|
||||
|
||||
db_test_this :-
|
||||
{repeat(100)},
|
||||
assertz(pred_this),
|
||||
fail.
|
||||
db_test_this :-
|
||||
retract(pred_this),
|
||||
fail.
|
||||
db_test_this.
|
||||
|
||||
db_test_self :-
|
||||
{repeat(100)},
|
||||
::assertz(pred_self),
|
||||
fail.
|
||||
db_test_self :-
|
||||
::retract(pred_self),
|
||||
fail.
|
||||
db_test_self.
|
||||
|
||||
|
||||
db_test_obj :-
|
||||
this(This),
|
||||
{repeat(100)},
|
||||
This::assertz(pred_obj),
|
||||
fail.
|
||||
db_test_obj :-
|
||||
this(This),
|
||||
This::retract(pred_obj),
|
||||
fail.
|
||||
db_test_obj.
|
||||
|
||||
:- end_object.
|
@@ -9,4 +9,4 @@
|
||||
% comment the next line if your Prolog compiler does not support modules
|
||||
:- ensure_loaded(module).
|
||||
|
||||
:- initialization(logtalk_load(object)).
|
||||
:- initialization(logtalk_load([object, database])).
|
||||
|
@@ -20,3 +20,17 @@ my_length([], Length, Length).
|
||||
my_length([_| Tail], Acc, Length) :-
|
||||
Acc2 is Acc + 1,
|
||||
my_length(Tail, Acc2, Length).
|
||||
|
||||
|
||||
:- dynamic(pred_plain/0).
|
||||
|
||||
db_test_plain :-
|
||||
repeat(100),
|
||||
assertz(pred_plain),
|
||||
fail.
|
||||
|
||||
db_test_plain :-
|
||||
retract(pred_plain),
|
||||
fail.
|
||||
|
||||
db_test_plain.
|
||||
|
Reference in New Issue
Block a user