lars.br...@gmail.com writes:
>It would be interesting to remake Anton's code size survey with the
>current crop of instruction sets and compiler technologies.
Debian currently has different sets of architectures for the different
releases, and different versions of programs for the releases, so I
produced two sets of data, as follows:
for i in amd64 armel armhf i386 ia64 mips mipsel powerpc s390 s390x sparc; do
wget
http://ftp.at.debian.org/debian/pool/main/b/bash/bash_4.2+dfsg-0.1+deb7u3_$i.deb
wget
http://ftp.at.debian.org/debian/pool/main/g/grep/grep_2.12-2_$i.deb
wget
http://ftp.at.debian.org/debian/pool/main/g/gzip/gzip_1.5-1.1_$i.deb
done
for i in amd64 armel armhf i386 ia64 mips mipsel powerpc s390 s390x sparc; do
ar x bash_4.2+dfsg-0.1+deb7u3_$i.deb; tar xfz data.tar.gz ./bin/bash; objdump -h bin/bash|awk --non-decimal-data '/[.]text/ {printf("%8d ","0x"$3)}'
ar x grep_2.12-2_$i.deb; tar xfz data.tar.gz ./bin/grep; objdump -h bin/grep|awk --non-decimal-data '/[.]text/ {printf("%8d ","0x"$3)}'
ar x gzip_1.5-1.1_$i.deb; tar xfz data.tar.gz ./bin/gzip; objdump -h bin/gzip|awk --non-decimal-data '/[.]text/ {printf("%8d ","0x"$3)}'
echo $i
done|sort -nk1
for i in amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64el s390x; do
wget
http://ftp.at.debian.org/debian/pool/main/b/bash/bash_4.4-5_$i.deb
wget
http://ftp.at.debian.org/debian/pool/main/g/grep/grep_2.20-4.1_$i.deb
wget
http://ftp.at.debian.org/debian/pool/main/g/gzip/gzip_1.6-4_$i.deb
done
for i in amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64el s390x; do
ar x bash_4.4-5_$i.deb; tar xfJ data.tar.xz ./bin/bash; objdump -h bin/bash|awk --non-decimal-data '/[.]text/ {printf("%8d ","0x"$3)}'
ar x grep_2.20-4.1_$i.deb; tar xfJ data.tar.xz ./bin/grep; objdump -h bin/grep|awk --non-decimal-data '/[.]text/ {printf("%8d ","0x"$3)}'
ar x gzip_1.6-4_$i.deb; tar xfJ data.tar.xz ./bin/gzip; objdump -h bin/gzip|awk --non-decimal-data '/[.]text/ {printf("%8d ","0x"$3)}'
echo $i
done|sort -nk1
To reproduce, you should replace
ftp.at.debian.org with your local
mirror.
Note that there is no mips64el package for grep and gzip, so the
outputs you see for these packages are nonsense (deleted below).
Here's the output for one set of architectures and package versions,
sorted by bash code size:
bash grep gzip
398384 88084 47944 armhf
584340 130872 68276 armel
588972 129096 66892 amd64
604656 131804 66268 i386
637620 133868 72712 s390
638912 140544 71744 sparc
674912 141120 74032 mipsel
674912 141168 74112 mips
680928 139664 74272 powerpc
688052 150680 75908 s390x
1539872 322432 158656 ia64
And here's the (edited) output for the other set:
bash grep gzip
510144 105100 46992 armhf
697794 148122 62506 amd64
712580 134116 59452 arm64
754436 152948 61724 i386
787780 157384 63268 armel
841024 171824 75536 powerpc
854272 177088 72600 s390x
899984 mips64el
916848 182400 77072 mipsel
917024 182432 77104 mips
971684 186296 84912 ppc64el
These are the CONTENT field of the .text section of the binaries. I
don't know what the CONTENT field means, so it may be the wrong size.
32-bit: armhf armel i386 s390 sparc mipsel mips powerpc
64-bit: arm64 amd64 ia64 s390x mips64el ppc64el
The difference between armhf and armel on these integer-only codes is
surprising. In the older set, mips and mipsel were smaller than
powerpc and s390x, in the newer they are larger. I take this as an
indicated that compiler direction (possibly influenced by
microarchitecture, such as favouring code alignment to bigger
boundaries) may have a larger influence on code size than the
instruction set. Overall, apart from armhf and ia64, the
architectures are remarkably similar in code size, especially in the
first set.
Followups set to comp.arch.
- anton
--
M. Anton Ertl
http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs:
http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard:
http://www.forth200x.org/forth200x.html
EuroForth 2017:
http://euro.theforth.net/