-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I saw results of the little experiment by Robo Cernansky
<http://article.gmane.org/gmane.linux.gentoo.user/52619>
and decided to repeat it, but automating it
Since there are lots of CFLAGS-related question, I will post the scripts I
put together, hoping they will be useful for others, too.
- --------[ input for build.sh (lines numbered for readability) ]---------
1 -O0
2 -march=pentium3 -mmmx -O2 -fomit-frame-pointer
3 -march=pentium3 -mmmx -O3 -fomit-frame-pointer
4 -march=pentium3 -mmmx -O3 -fomit-frame-pointer -falign-functions=4
-falign-jumps=4
5 -march=pentium3 -mmmx -O3 -fomit-frame-pointer -falign-functions=4
-falign-jumps=4 -fforce-addr
6 -march=pentium3 -mmmx -O2 -fomit-frame-pointer -frename-registers
7 -march=pentium3 -mmmx -O2 -fomit-frame-pointer -falign-functions=4
-falign-jumps=4
8 -march=pentium3 -mmmx -O2 -fomit-frame-pointer -frename-registers
-falign-functions=4 -falign-jumps=4
9 -march=pentium3 -mmmx -O2 -fomit-frame-pointer -fforce-addr
10 -march=pentium3 -mmmx -O2 -fomit-frame-pointer -fforce-addr
-frename-registers
11 -march=pentium3 -mmmx -O2
12 -march=pentium3 -mmmx -Os
13 -march=pentium3 -mmmx -Os -fomit-frame-pointer
14 -march=pentium3 -mmmx -Os -fomit-frame-pointer -falign-functions=4
-falign-jumps=4
- ------------------------------------------------------------------------
- --------[ build.sh ]----------------------------------------------------
#!/bin/bash
set -e
base_CFLAGS="-static"
srcdir=${HOME}/src/gnuchess-5.07
exesubdir="src"
exefile="gnuchess"
i=1
while read REPLY; do
cflags="$base_CFLAGS $REPLY"
echo "Building configuration $i using CFLAGS=\"$cflags\""
mkdir -p builddir-$i
pushd builddir-$i >/dev/null
${srcdir}/configure CFLAGS="$cflags"
make clean
make
popd >/dev/null
cp builddir-$i/${exesubdir}/${exefile} ${exefile}-$i
strip ${exefile}-$i
i=$(( $i + 1 ))
done
- ------------------------------------------------------------------------
- --------[ runtest.sh ]--------------------------------------------------
#!/bin/bash
set -e
exefile="gnuchess"
runstep() {
depth=$1
i=1
while [ -x ${exefile}-$i ]; do
echo -en "depth $depth\ngo\nquit" | ./${exefile}-$i | grep '^Time =
' | cut -d" " -f3
i=$(( $i + 1 ))
done
}
#
# $1 - number of times to repeat test
# $2 - solution search depth for gnuchess (8 or 9 are reasonable values)
#
for j in $(seq 1 $1); do
runstep $2 | paste -s
done
- ------------------------------------------------------------------------
If somebody cares about results:
Compiler: gcc version 3.3.2 (Debian)
Cpu: Intel Celeron (Coppermine) stepping 03
Kernel: 2.4.22 (no preemption)
Test environment: console, normal user, (almost) no processes running
Mean times from ./runtest.sh 100 8 and from ./runtest.sh 40 9
1 9.3130 29.4350
2 6.7630 21.1125
3 7.0560 22.3650
4 7.8630 24.7250
5 6.8040 21.5450
6 6.8470 21.9425
7 6.8190 21.2250
8 7.0280 22.1375
9 6.9850 21.8800
10 7.1140 22.3450
11 7.2560 22.9500
12 6.7550 21.4675
13 6.5830 21.0025
14 6.7410 21.4100
I can see that a simple '-O2 -fomit-frame-pointer' (2) does a pretty good
job, and confirm that -Os leads to fast results (in this specific test, of
course).
I'd like to see such a test with a (cpu-intensive) floating-point program
(perhaps povray?)
Best regards
- --
Danilo Piazzalunga <[EMAIL PROTECTED]> | Linux User #245762
| Powered by Debian GNU/Linux
Public key: search.keyserver.net +-----------------------------
Fingerprint: D018 815E 8C7F 2AE2 5565 0C36 B5F6 DB20 B800 CB9F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/so0EtfbbILgAy58RAhMhAJ4/d1yKs604mNAqrClbVBA0OG+ASQCdHcqb
CUFecL6yrk7d25w9TOOE3XQ=
=8Haq
-----END PGP SIGNATURE-----
--
[EMAIL PROTECTED] mailing list