[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most of the following tests are done on Linux with the MySQL benchmarks, but they should give some indication for other operating systems and workloads.
You get the fastest executable when you link with -static
.
On Linux, you will get the fastest code when compiling with pgcc
and -O3
. To compile `sql_yacc.cc' with these options, you
need about 200M memory because gcc/pgcc
needs a lot of memory to
make all functions inline. You should also set CXX=gcc
when
configuring MySQL to avoid inclusion of the libstdc++
library (it is not needed). Note that with some versions of pgcc
,
the resulting code will run only on true Pentium processors, even if you
use the compiler option that you want the resulting code to be working on
all x586 type processors (like AMD).
By just using a better compiler and/or better compiler options you can get a 10-30% speed increase in your application. This is particularly important if you compile the SQL server yourself!
We have tested both the Cygnus CodeFusion and Fujitsu compilers, but when we tested them, neither was sufficiently bug free to allow MySQL to be compiled with optimizations on.
When you compile MySQL you should only include support for the
character sets that you are going to use. (Option --with-charset=xxx
.)
The standard MySQL binary distributions are compiled with support
for all character sets.
Here is a list of some measurements that we have done:
pgcc
and compile everything with -O6
, the
mysqld
server is 1% faster than with gcc
2.95.2.
-static
), the result is 13%
slower on Linux. Note that you still can use a dynamic linked
MySQL library for your client applications. It is the server that is most
critical for performance.
mysqld
binary with strip libexec/mysqld
,
the resulting binary can be up to 4% faster.
localhost
,
MySQL uses a socket file by default.)
--with-debug=full
, most queries will be 20% slower.
Some queries may take substantially longer (for example,
the MySQL benchmarks ran 35% slower). If you use --with-debug
,
the slowdown will be only 15%. For a mysqld
version that has
been compiled with --with-debug=full
, you can disable memory
checking at runtime by starting it with the --skip-safemalloc
option. The end result in this case should be close to when configuring
with --with-debug
.
gcc
3.2.
gcc
2.95.2 for UltraSPARC with the option
-mcpu=v8 -Wa,-xarch=v8plusa
gives 4% more performance.
--log-bin
makes mysqld
1% slower.
gcc
without frame pointers
-fomit-frame-pointer
or -fomit-frame-pointer -ffixed-ebp
makes mysqld
1-4% faster.
The MySQL-Linux distribution provided by MySQL AB used
to be compiled with pgcc
, but we had to go back to regular gcc
because of a bug in pgcc
that would generate the code that does
not run on AMD. We will continue using gcc
until that bug is resolved.
In the meantime, if you have a non-AMD machine, you can get a faster
binary by compiling with pgcc
. The standard MySQL
Linux binary is linked statically to make it faster and more portable.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |