|Did you know ...||Search Documentation:|
|Choosing between 32- and 64-bit Prolog|
For those cases where we can choose between 32 and 64 bits, either because the hardware and OS support both or because we can still choose the hardware and OS, we give guidelines for this decision.
First of all, if SWI-Prolog needs to be linked against 32- or 64-bit native libraries, there is no choice as it is not possible to link 32- and 64-bit code into a single executable. Only if all required libraries are available in both sizes and there is no clear reason to use either do the different characteristics of Prolog become important.
Prolog applications that require more than the 128 MB stack limit provided in 32-bit addressing mode must use the 64-bit edition. Note however that the limits must be doubled to accommodate the same Prolog application.
If the system is tight on physical memory, 32-bit Prolog has the clear advantage of using only slightly more than half of the memory of 64-bit Prolog. This argument applies as long as the application fits in the virtual address space of the machine. The virtual address space of 32-bit hardware is 4GB, but in many cases the operating system provides less to user applications.
The only standard SWI-Prolog library adding significantly to this calculation is the RDF database provided by the semweb package. It uses approximately 80 bytes per triple on 32-bit hardware and 150 bytes on 64-bit hardware. Details depend on how many different resources and literals appear in the dataset as well as desired additional literal indexes.
Summarizing, if applications are small enough to fit comfortably in virtual and physical memory, simply take the model used by most of the applications on the OS. If applications require more than 128 MB per stack, use the 64-bit edition. If applications approach the size of physical memory, fit in the 128 MB stack limit and fit in virtual memory, the 32-bit version has clear advantages. For demanding applications on 64-bit hardware with more than about 6GB physical memory the 64-bit model is the model of choice.