?- time(true).
% 1 inferences, 0.000 CPU in 0.000 seconds (50% CPU, 200000 Lips)
true.
?- time((between(1,1000000,N), \+ float(N), fail; true)).
% 2,999,999 inferences, 0.085 CPU in 0.085 seconds (100% CPU, 35381936 Lips)
true.
?- time((between(1,1000000,N), call(\+ float(N)), fail; true)).
% 2,999,999 inferences, 0.239 CPU in 0.239 seconds (100% CPU, 12562915 Lips)
true.
Same issue in the same file around line 162. The Logtalk linter reports this issues as:
* Suspicious call: call(\+A) instead of \+A
* while compiling object viterbi
* in file /Users/pmoura/Downloads/cplint-master/prolog/viterbi.pl between lines 114-117
*
* Suspicious call: call(\+A) instead of \+A
* while compiling object viterbi
* in file /Users/pmoura/Downloads/cplint-master/prolog/viterbi.pl between lines 160-163
In the following line, the use of
call/1
is redundant but also expensive:https://github.com/friguzzi/cplint/blob/242814b87dca800eacccf88657e518175592e82e/prolog/viterbi.pl#L116
An example illustrating the cost:
Same issue in the same file around line 162. The Logtalk linter reports this issues as: