It is a well-known fact that a good compiler can emit an optimal code thereby allowing software to produce better throughput. Clang compiler popularity continues to grow and since I am working mostly on performance issues I am often asked if I have tried MariaDB-on-Arm with clang compiled binaries. Finally, I got some time and decided to try it out.
GCC vs Clang – with MariaDB on ARM appeared first on MariaDB.org
It is a well-known fact that a good compiler can emit an optimal code thereby allowing software to produce better throughput. Clang compiler popularity continues to grow and since I am working mostly on performance issues I am often asked if I have tried MariaDB-on-Arm with clang compiled binaries. Finally, I got some time and decided to try it out.
SetupThe difference is quite marginal in most cases so a normal graph will not be able to capture it clearly so we will use some kind of heat map.
Notes: green cell represents the highest throughput for the said test case. Like for ps-uni (point-select uniform 128 threads), the highest throughput is seen with clang-o3 and lowest with clang-ofast

Based on overall observation it sounds like with a lot of contention and higher throughput clang continues to perform but with normal contention and lower throughput gcc continues to perform. Let’s try to re-confirm this with some more experiments.

Let’s try to run a full benchmark with all thread scalabilities (1-256) with the short-listed modes (gcc-Ofast, clang-O3)

Based on the said study, there is no clear winner. Depending on use-case at times clang score and at times gcc score. Of-course the optimization mode could be O3 with clang and Ofast with gcc. Also, make a note that -Ofast (optimize very aggressively to the point of breaking standard compliance).
If you have more questions/queries do let me know. Will try to answer them.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | gcc vs clang for sysbench on a small server with Postgres, MySQL and MariaDB | 0 | 7.24 | 31-03-2026 |
| 2 | MySQL Ecosystem on ARM – Percona Live ONLINE Talk Preview | 0 | 12.91 | 07-10-2020 |
| 3 | openGauss on ARM | 0 | 11.77 | 23-08-2022 |
| 4 | Building MariaDB Server from the sources | 0 | 5.29 | 05-04-2024 |
| 5 | Sysbench vs MariaDB on a small server: using the same charset for all versions | 0 | 8.32 | 06-04-2026 |
| 6 | Quick builds and rebuilds of MariaDB using Docker | 0 | 8.01 | 12-03-2023 |
| 7 | Simple tool to build MariaDB commits for performance-change analysis | 0 | 6.98 | 18-06-2026 |
| 8 | The Insert Benchmark vs MariaDB 10.2 to 13.0 on a 32-core server | 0 | 6.43 | 08-04-2026 |
| 9 | CPU efficiency for MariaDB, MySQL and Postgres on TPROC-C with a small server | 0 | 4.26 | 16-03-2026 |
| 10 | New book (coming) – MariaDB for Developers | 0 | 7.06 | 31-12-2023 |