Previous Up Next

3.8  How do I make my programs run faster?

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.

[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

[eclipse 4]:

Section 6.7 contains more detailed discussion on other techniques which can be used to optimise your programs.

Previous Up Next