1. -static 13%
--with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static
静态链接提高13%性能
2. -pgcc 1%
CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
-felide-constructors -fno-exceptions -fno-rtti"
如果是Inter处理器,使用pgcc提高1%性能
3. Unix Socket 7.5%
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
使用unix套接字链接提高7.5%性能,所以在windows下mysql性能肯定不如unix下面
4. --enable-assembler
允许使用汇编模式(优化性能)
下面是总体的编译文件
编译代码
- CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
- -fno-exceptions -fno-rtti -fomit-frame-pointer -ffixed-ebp"
- ./configure \
- --prefix=/usr/local/mysql --enable-assembler \
- --with-mysqld-ldflags=-all-static
- --with-client-ldflags=-all-static
- --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
- --with-charset=utf8
- --with-collation=utf8_general_ci
- --with-extra-charsets=all