By default, ECLiPSe compiles programs as traceable, which means that they can be traced using the built-in debugger. To obtain maximum efficiency, the directive nodbgcomp/0 should be used, which will set some flags to produce a more efficient and shorter code:
[eclipse 2]: nodbgcomp. yes. [eclipse 3]: [user]. father(abraham, isaac). father(isaac, jacob). father(jacob, joseph). ancestor(X, Y) :- father(X, Y). ancestor(X, Y) :- ancestor(X, Z), ancestor(Z, Y). user compiled optimized 396 bytes in 0.02 seconds yes. [eclipse 4]:
Section 6.7 contains more detailed discussion on other techniques which can be used to optimise your programs.