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, but it is fast with dynamic code,
meta-calling and predicates that contain large numbers of clauses or
require more advanced clauses indexing. Many of SWI-Prolog's built-in
predicates are written in C and have excellent performance.
On the other hand, SWI-Prolog offers some facilities that are widely
appreciated by users:
- Comprehensive support of Prolog extensions
Many modern Prolog implementations extend the standard SLD resolution
mechanism with which Prolog started and that is described in the ISO
standard. SWI-Prolog offers most popular extensions.
Attributed variables provide Constraint Logic
Programming and delayed execution based on instantiation (coroutining). Tabling
or SGL resolution provides characteristics normally associated
with bottom up evaluation: better termination, better
predictable performance by avoiding recomputation and Well Founded
Semantics for negation.
Delimited continuations can be used to implement high level new
control structures and Engines can be used to control multiple
Prolog goals, achieving different control structures such as massive
numbers of cooperating agents.
- 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), VScode 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
12). It can also be embedded in external programs (see
section 12.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. Threads
also facilitates debugging and maintenance of long running processes and
embedded Prolog engines. The native IDE tools run in a separate thread
The library(prolog_server)
library provides telnet
access and the pack libssh
provides SSH login. With some
restrictions regarding the compatibility of old and new code, code can
be replaced while it is being executed in another thread. This allows
for injecting
debug/3
statements as well as fixing bugs without downtime.
- Interfaces
SWI-Prolog ships with many extension packages that provide robust
interfaces to processes, encryption, TCP/IP, TIPC, ODBC, SGML/XML/HTML,
RDF, JSON, YAML, HTTP, graphics and much more.