There are many different ways to optimize how well MariaDB performs. You can for example optimize a wide variety of configuration options in the my.cnf file, or you can analyze your queries, maybe change them a little or add indexes where appropriate.
Another area of optimization is to optimize the actual binaries of MariaDB at compilation time. Also here there are several options for optimizing the produced binaries to fit the environment and workload at hand. One can customize the build by making use of a long list of configuration options. It’s of course also possible to use different compilers. MariaDB is usually built with GCC on all the different platforms.
GCC supports something called Profile-Guided Optimization (PGO). The idea with PGO is that it makes use of data collected with test runs and knows which areas of the code are the most commonly used ones and optimizes the output binary accordingly. In this benchmark MariaDB Enterprise binaries have been produced with this approach and compared to binaries that haven’t been profile guided when built.