Re: [dwm] improve config.mk

From: Cedric Krier <ced_AT_ced.homedns.org>
Date: Thu, 7 Sep 2006 11:01:58 +0200

On 07/09/06 10:47 +0200, Anselm R. Garbe wrote:
> On Thu, Sep 07, 2006 at 10:32:33AM +0200, Anselm R. Garbe wrote:
> > No, because CFLAGS might inherit totally retarded options from
> > the host OS with your patch. Also, the -OXXX -march=XXXX options
> > don't bring any real benefit. You shouldn't believe the FUD the
> > gentoo people want to make you believe. The gcc optimizations
> > are kind of a joke compared to other commercial C compilers.
> > -Os is optimizing for size and the architecture is implicitely
> > given by the compiler. If your userland is already builded for
> > the athlon-xp architecture and your compiler toolchain is linked
> > as well to athlon-xp architecture, you don't need to set any
> > options in gcc. Just compare the binaries with -O3 and -O3
> > -march=athlon-xp, I doubt you will see much or any difference in
> > your environment. Apart from that, I doubt you will be able to
> > measure any difference in resource usage, cpu execution time,
> > and what not.
>
> I did a small investigation:
>
> /tmp $ uname -a
> OpenBSD mmvi.10kloc.org 3.9 GENERIC#617 i386
>
> /tmp $ gcc -v
> Reading specs from
> /usr/lib/gcc-lib/i386-unknown-openbsd3.9/3.3.5/specs
> Configured with:
> Thread model: single
> gcc version 3.3.5 (propolice)
>
> /tmp $ for i in dwm.O*; do md5 $i; done
> MD5 (dwm.O3) = b28f0ea9c1d9f605816518fb40eeb08c
> MD5 (dwm.O3.athlon-xp) = 1c3938a720ca7474654129ed6e61b716
> MD5 (dwm.O3.i386) = b28f0ea9c1d9f605816518fb40eeb08c
> MD5 (dwm.O3.i686) = 4dc18766728f4116a51533038ce7864d
> MD5 (dwm.Os) = a89ccc4fdd1e75b9ed35c4ff028d9bbf
> MD5 (dwm.Os.i386) = a89ccc4fdd1e75b9ed35c4ff028d9bbf
> MD5 (dwm.Os.i686) = c2cb75100267c9bd8c0a9dd33cca4da8
>
> /tmp $ ls -l dwm.O*
> -rwxr-xr-x 1 arg arg 35332 Sep 7 10:39 dwm.O3
> -rwxr-xr-x 1 arg arg 39428 Sep 7 10:39 dwm.O3.athlon-xp
> -rwxr-xr-x 1 arg arg 35332 Sep 7 10:37 dwm.O3.i386
> -rwxr-xr-x 1 arg arg 39428 Sep 7 10:38 dwm.O3.i686
> -rwxr-xr-x 1 arg arg 31268 Sep 7 10:36 dwm.Os
> -rwxr-xr-x 1 arg arg 31268 Sep 7 10:37 dwm.Os.i386
> -rwxr-xr-x 1 arg arg 31268 Sep 7 10:37 dwm.Os.i686
>
> As you see, if the toolchain is configured for i386, an explicit
> -march has no effect. Only if the -march is different you get
> different results.
>

I made also a test. I compile dwm with

gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.6
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib
--disable-checking --disable-werror --disable-libunwind-exceptions
--disable-multilib --disable-libgcj --enable-languages=c,c++
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)

-rwxr-xr-x 1 ced users 32660 2006-09-07 10:47 dwm.O3
-rwxr-xr-x 1 ced users 32564 2006-09-07 10:48 dwm.O3.athlon-xp

wc dwm.*.objdump
9649 58836 486225 dwm.O3.athlon-xp.objdump
9722 60004 503558 dwm.O3.objdump

There is 73 instructions in less. I know it is not very important but
there is a difference.

Cédric

Received on Thu Sep 07 2006 - 11:09:50 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:31:03 UTC