1.3 Should I be using SWI-Prolog?
There are a number of reasons why it might be better to choose a commercial, or another free, Prolog system:
- SWI-Prolog comes with no warranties
Although the developers or the community often provide a work-around or a fix for a bug, there is no place you can go to for guaranteed support. However, the full source archive is available and can be used to compile and debug SWI-Prolog using free tools on all major platforms. Users requiring more support should ensure access to knowledgeable developers. - Performance is your first concern
Various free and commercial systems have better performance. But, `standard' Prolog benchmarks disregard many factors that are often critical to the performance of large applications. SWI-Prolog is not good at fast calling of simple predicates and if-then-else selection based on simple built-in tests, but it is fast with dynamic code, meta-calling and predicates that contain large numbers of clauses. Many of SWI-Prolog's built-in predicates are written in C and have excellent performance. - You need features not offered by SWI-Prolog
Although SWI-Prolog has many features, it also lacks some important features. The most well known is probably tabling Freire et al., 1997. If you require additional features and you have resources, be it financial or expertise, please contact the developers.
On the other hand, SWI-Prolog offers some facilities that are widely appreciated by users:
- Nice environment
SWI-Prolog provides a good command line environment, including `Do What I Mean', autocompletion, history and a tracer that operates on single key strokes. The system automatically recompiles modified parts of the source code using the make/0 command. The system can be instructed to open an arbitrary editor on the right file and line based on its source database. It ships with various graphical tools and can be combined with the SWI-Prolog editor, PDT (Eclipse plugin for Prolog) or GNU-Emacs. - Fast compiler
Even very large applications can be loaded in seconds on most machines. If this is not enough, there is the Quick Load Format. See qcompile/1 and qsave_program/2. - Transparent compiled code
SWI-Prolog compiled code can be treated just as interpreted code: you can list it, trace it, etc. This implies you do not have to decide beforehand whether a module should be loaded for debugging or not, and the performance of debugged code is close to that of normal operation. - Source level debugger
The source level debugger provides a good overview of your current location in the search tree, variable bindings, your source code and open choice points. Choice point inspection provides meaningful insight to both novices and experienced users. Avoiding unintended choice points often provides a huge increase in performance and a huge saving in memory usage. - Profiling
SWI-Prolog offers an execution profiler with either textual output or graphical output. Finding and improving hotspots in a Prolog program may result in huge speedups. - Flexibility
SWI-Prolog can easily be integrated with C, supporting non-determinism in Prolog calling C as well as C calling Prolog (see section 11). It can also be embedded in external programs (see section 11.5). System predicates can be redefined locally to provide compatibility with other Prolog systems. - Threads
Robust support for multiple threads may improve performance and is a key enabling factor for deploying Prolog in server applications. - Interfaces
SWI-Prolog ships with many extension packages that provide robust interfaces to processes, encryption, TCP/IP, TIPC, ODBC, SGML/XML/HTML, RDF, HTTP, graphics and much more.