Re: cut and efficiency



Advait wrote:
hello prologers

I have few questions
1. Does 'cut' ( '!' ) increases efficiency of code ?
2. Does it reduces memory usage of code?

Plz let me know the fact

(1) sometimes
(2) sometimes


If cut cuts away an alternative that the compiler hasn't eliminated
at compile time, the program uses less memory and doesn't backtrack
unnecesseraly - gain in time and space. It also has a positive effect
on garbage collection (less live data, smaller root set)

If cut does not cut away an alternative (because there wasn't one,
or because the compiler has eliminated it at compile time), and if
the compiler has not eliminated the cut, then you loose time, and
possibly a little space - depending on the implementation of cut.

Cheers

Bart Demoen
.



Relevant Pages