分类: Mysql/postgreSQL
2011-10-13 11:43:54
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="-O6" CXX=pgcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti"
64bits:
CFLAGS="-O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64" CXXFLAGS="-O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64" CXX=pgcc CFLAGS="-DDBUG_OFF -O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64" CXXFLAGS="-DDBUG_OFF -O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64 -fno-implicit-templates -fno-exceptions -fno-rtti"
5.0编译参数:
./configure '--prefix=/opt/mysql' '--with-unix-socket-path=/tmp/mysql.sock' '--localstatedir=/opt/mysql/data' '--with-mysqld-user=mysql' '--without-isam' '--without-innodb' '--with-big-tables' '--with-charset=utf8' '--with-extra-charsets=all' '--with-pthread' '--enable-thread-safe-client' '--enable-assembler' '--with-archive-storage-engine' '--with-client-ldflags=-all-static' '--with-readline' '--enable-local-infile'
5.1编译参数:
./configure '--prefix=/opt/mysql' '--with-unix-socket-path=/tmp/mysql.sock' '--localstatedir=/opt/mysql/data' '--with-mysqld-user=mysql' '--without-ndb-debug' '--with-big-tables' '--with-charset=utf8' '--with-extra-charsets=all' '--with-pthread' '--enable-thread-safe-client' '--enable-assembler' '--with-archive-storage-engine' '--with-client-ldflags=-all-static' '--with-readline' '--enable-local-infile'
注意:
在Linux-x86上使用gcc编 译而不用帧指针(-fomit-frame-pointer or -fomit-frame-pointer -ffixed-ebp),可以使mysqld快1-4%。