PDA

View Full Version : Ottimizzazione in compilazione (Flags e Cflags):dubbi.


Dcromato
27-09-2006, 16:26
Non uso molto repoman in Frugalware se non proprio per applicazioni closed.La curiosità però di vedere se con questa distro ottenevo risultati mi ha spinto a modificare il file /etc/makepkg.conf in questo modo:

#
# /etc/makepkg.conf
#

# The FTP/HTTP download utility that makepkg should use to acquire sources
export FTPAGENT="/usr/bin/wget -U makepkg --continue --passive-ftp --tries=3 --waitretry=3 --no-check-certificate"
#export FTPAGENT="/usr/bin/snarf"
#export FTPAGENT="/usr/bin/lftpget -c"

export CARCH="i686"
export CHOST="i686-pc-linux-gnu"

# Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon exclusive (binaries
# will use the P6 instruction set and only run on P6+ systems)
export CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer "
export CXXFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"
# Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon optimized (but binaries
# will run on any x86 system)
#export CFLAGS="-mcpu=i686 -O2 -pipe"
#export CXXFLAGS="-mcpu=i686 -O2 -pipe"

# SMP Systems
#export MAKEFLAGS="-j2"

# Enable fakeroot for building packages as a non-root user
export USE_FAKEROOT="y"

# Specify a directory for the chroot environment.
export CHROOTDIR="/var/chroot"
# Core package list to be installed in the chroot.
export COREPKGS="core chroot-core devel-core"

# Enable distributed C/C++/ObjC compiler
# Don't forget to modify MAKEFLAGS to include -jN, where N is twice the
# number of CPUs +1 available
export DISTCC="n"
# Space-separated list of volunteer host specifications.
export DISTCC_HOSTS=""

# Enable colorized output messages
export USE_COLOR="y"

# Specify a fixed directory where all packages will be placed
#export PKGDEST=/home/packages

# If you want your name to show up in the packages you build, change this.
export PACKAGER="Frugalware Linux (http://frugalware.org)"

# Don't strip symbols from binaries/libraries
#export NOSTRIP="1"
# Don't prepare documentation
#export NODOCS="1"

# LOGDIR is the location where you would like to store a
# permanant copy of the build log.
# filename = [LOGDIR_APPEND]-[pkgname]-[pkgver]-[pkgrel]
LOGDIR_APPEND=`date +%Y-%m-%d-%s`
LOGDIR=/var/log/builds

# The Standard Build Unit of this machine
# If 1, then the build time will be displayed in seconds
# Build the "binutils" package, and then write here the result you got,
# so that makepkg will could the right SBU value for you.
SBU="1"

Ho messo in rosso la parte che ho modificato.Il mio dubbio era:
L'aver messo pentium3 mi esenta dal fatto d'inserire flag come mmmx, msse e via discorrendo?
Statisticamente parlando, si ottengono dei veri benefici?(sto chiedendo un po a tutti e non solo ai gentootisti)
Secondo voi su un processore come il mio ritenete sia meglio puntualizzare o allaggerire?
Mi spiego:Meglio ottenere binari leggeri o con piu istruzioni di compilazioni inerenti all'architettura?

eolus
27-09-2006, 18:29
A mio parere è sempre meglio ottimizzare in base all'architettura e alle funzioni ameno che i binary che ottieni non ti servono anche per altre macchine i vantaggi ci sono minori dimensioni minore occupazione memoria ecc. ecc. Ovviamente non bisogna esagere altrimenti...

Dcromato
27-09-2006, 19:52
MI sai dire se:

L'aver messo pentium3 mi esenta dal fatto d'inserire flag come mmmx, msse e via discorrendo?

matcy
27-09-2006, 20:41
attieniti alla bibbia e vivrai felice.
http://gentoo-wiki.com/Safe_Cflags
da quando uso gentoo ho scoperto questo sito, ma va bene x tutto.

eolus
27-09-2006, 22:12
MI sai dire se:
a mio parere non ti esenta altrimenti i binari che necessitano di quella funzione vengono compilati senza.

matcy
27-09-2006, 23:24
una arch comprende i blocchi di istruzioni della arch.
se metti k8 non devi aggiungere le sse e le sse2.
se però hai un core >= venice devi aggiungere sse3