================================================================= 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