Comparing GCC and CLANG for compiling SWI-Prolog

The performance for SWI-Prolog depends quite a bit on the C compiler used to build it. I did a small comparison between gcc (9.3) and clang (10) on Ubuntu 20.04, AMD 3950X. This uses the somewhat extended peirera benchmarks, normalized to gcc-9 = 100. “pgo” means compiled using profile-guided optimization.

Shorter is better.

Note that the distributed binaries are compiled using gcc with PGO. This applies for the Windows installers, MacOS bundle, snaps and Docker images

Currently the PPA for Ubuntu are compiled using the default gcc for the Ubuntu version without PGO. The Macport version uses by default the Xcode installed on your Mac and does not use PGO. Xcode use clang.

3 Likes