________________________________________________________________________

This file is part of Logtalk <https://logtalk.org/>  
Copyright 1998-2021 Paulo Moura <pmoura@logtalk.org>  
SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
________________________________________________________________________


% start by loading the example by choosing one of the loader files
% (you must quit and restart Logtalk for each testing scenario):


% run benchmarks with event support turned on and using static binding:

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


% run benchmarks with event support turned off and using static binding:

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

% or simply:

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


% list all the benchmark tests:

| ?- benchmarks::benchmark(Id, Goal).

Goal = my_length([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],_)
Id = s1 ? ;

Goal = object::length([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],_)
Id = s2 ? ;

Goal = my_nrev([0, 1, 2, 3, 4, 5, 6, 7|...], _G33)
Id = s3 ? ;

Goal = object::nrev([0, 1, 2, 3, 4, 5, 6|...], _G36)
Id = s4 ? ;

Goal = leaf::obj_local
Id = c1 ? ;

Goal = leaf::ctg_direct
Id = c2 ? ;

Goal = leaf::ctg_self
Id = c3 ? ;

Goal = create_object(xpto,[],[],[]),abolish_object(xpto)
Id = d1 ? ;

Goal = plain_dyndb
Id = d2 ? ;

Goal = database::this_dyndb
Id = d3 ? ;

Goal = database::self_dyndb
Id = d4 ? ;

Goal = database::other_dyndb
Id = d5

yes


% run all the benchmark tests the default number of times:

| ?- benchmarks::run.
...


% run all the benchmark tests 100000 times:

| ?- benchmarks::run(100000).
...


% or run specific sets of benchmark tests, for example:

| ?- benchmarks::run(s11, 1000000), benchmarks::run(s12, 1000000), benchmarks::run(s13, 1000000).
...

| ?- benchmarks::run(s21, 1000000), benchmarks::run(s22, 1000000), benchmarks::run(s23, 1000000).
...

| ?- benchmarks::run(s31, 1000000), benchmarks::run(s32, 1000000), benchmarks::run(s33, 1000000).
...
