Skip to content

Performance: C

xcc compiles C (C programs): it reads a .c file through clang’s front end and generates the code itself. These are the seven par benchmarks as plain C, the same files for every compiler, timed on an AMD Ryzen 9 9955HX (32 hardware threads) running Linux, with xcc 1.0, GCC 15.2 and clang 21.1, and on a Raspberry Pi 5.

Each machine has two tables, which measure different things and are never mixed: one thread is the code each core runs; every thread adds how a compiler spreads a loop across the cores.

Each compiler builds the plain C with no parallel code: xcc -O3 against gcc -O3 -march=native and clang -O3 -march=native.

Milliseconds; the median of up to fifteen runs.

benchmarkxccGCCclangxcc against GCCxcc against clang
mandel_deep860056147583646.5× faster6.8× faster
mandelbrot55.83263345.8× faster6.0× faster
md52293872121.69× faster1.08× slower
md5_mask1882771761.47× faster1.07× slower
nbody6.0027.396.14.5× faster16.0× faster
perlin73.764.474.81.14× slower1.01× faster
saxpy3.323.283.571.01× slower1.07× faster
geometric mean2.3× faster2.5× faster

The three do not compute quite the same arithmetic. GCC fuses a multiply and the add that follows it into one fused multiply-add instruction by default (-ffp-contract=fast, outside strict ISO C mode), and clang and xcc do so within a single expression (-ffp-contract=on). xcc’s fused code is in the AVX2 and AVX-512 copies of a function that the program picks at load, so on this machine its multiply-adds are fused too. perlin is mostly multiply-adds, and GCC’s fusing across statements is part of its lead there.

The same C, run across all 32 threads:

  • xcc: xcc -O3 --par-style=auto on the unchanged files. --par-style=auto finds the loops that can run in parallel and runs them as par blocks; here they are kept on the CPU (XC_PAR=cpu), so this is CPU against CPU.
  • GCC and clang: -O3 -march=native -fopenmp, on a copy of each file with one #pragma omp parallel for line (with its reduction clause where the loop has one) before the timed loop: the work a programmer does to get OpenMP’s threads.

Milliseconds; the median of up to fifteen runs. xcc is ahead of both on 5 of the 7.

benchmarkxccGCCclangxcc against GCCxcc against clang
mandel_deep371217022315.9× faster6.0× faster
mandelbrot2.4512.212.85.0× faster5.2× faster
md59.3916.113.41.72× faster1.43× faster
md5_mask8.1712.113.41.48× faster1.64× faster
nbody0.451.299.922.9× faster22× faster
perlin5.644.387.051.29× slower1.25× faster
saxpy2.262.182.321.04× slower1.03× faster
geometric mean2.1× faster3.0× faster

The same programs on GPUs, where --par-style=auto sends them by default, are on Performance: GPU.

The same seven programs on a Raspberry Pi 5 Model B Rev 1.0 (Cortex-A76), its 4 cores, under Raspberry Pi OS: xcc 1.0 cross-built them with -A arm64-linux; GCC 14.2 and clang 19.1 built them on the Pi, with the same flags as above.

Milliseconds; the median of up to fifteen runs:

benchmarkxccGCCclangxcc against GCCxcc against clang
mandel_deep502351276681324722.5× faster2.6× faster
mandelbrot3197708092.4× faster2.5× faster
md52860515429131.80× faster1.02× faster
md5_mask2346410723861.75× faster1.02× faster
nbody94.910897.21.13× faster1.02× faster
perlin3252863391.14× slower1.04× faster
saxpy30.430.929.51.02× faster1.03× slower
geometric mean1.53× faster1.33× faster

xcc --par-style=auto, GCC and clang with OpenMP, milliseconds. xcc is ahead of both on 5 of the 7:

benchmarkxccGCCclangxcc against GCCxcc against clang
mandel_deep1337731951340112.4× faster2.5× faster
mandelbrot85.31932032.3× faster2.4× faster
md571512967321.81× faster1.02× faster
md5_mask58510275981.75× faster1.02× faster
nbody23.826.924.11.13× faster1.01× faster
perlin81.371.688.21.14× slower1.08× faster
saxpy34.734.534.21.01× slower1.02× slower
geometric mean1.50× faster1.32× faster

On the Pi, xcc’s escape vectoriser runs mandelbrot’s and mandel_deep’s per-pixel loop four pixels at a time in NEON, which neither GCC nor clang vectorises.

Every program prints its checksum and its best time over its own repeats; each build was run several times, round-robin with the others, the machine idle before each round, and the figure is the median of those runs’ best times. The spread from run to run is wide for all three compilers on this machine (several tens of percent on the shortest programs), which is why one run is never the figure. Every build of a program gave the same checksum.

The C sources and their OpenMP copies are in xcc-c-bench-sources-1.0.tar.bz2, and in the repository’s benchmark/par/c/ and benchmark/par/c/openmp/; benchmark/par/c_run.py repeats the whole measurement.