Friday, December 17, 2010

SBR600: Reflection

During my time in SBR600 in this semester, as a CTY student, I kept asking myself if this is the right course for me. The reason is that, in CTY, I have learnt some scripting skills as well as some web developing skills, but none of the courses were about software development. Until I did my project version 0.1, there was a big question within myself, which was; why am I learning how to release software when I don’t even know how to build one?

I started my project “To Thumb? Or not to Thumb?” This whole idea of building kernel and repository and solving dependency problems was something seemed like a rocket science, made me wonder if there was a prerequisite course that I missed before taking SBR600. Professor Chris Tyler and Raymond Chan (in my OPS535 course) said this during a lecture (and they both happened to say this during the same week) that “No one is able to complete a job by him/herself in the today’s industry. One critical skill to acquire is learning to collaborate and cooperate with others.” That made me wake up and notice what I had not been noticing. Maybe this whole Fedora-ARM project thing is a rocket science, but no one told me that I had to understand and acquire knowledge on the all aspects of it. This is when I got motivated and had desire to be the part of the community.

Quite honestly, I still do not have clear idea of armv5tel architecture in many ways. But I believe that what SBR600 gave me to leave with is one of the most valuable knowledge that I acquired in my entire CTY program. I got a sense of and experienced how the Linux community works and evolves, even more fortunately, I had an honour to observe discussions between many Fedora-ARM developers in the IRC. I learned the importance of cooperating with others. Lastly and most importantly, I’ve learned that since computer science and IT industry continuously and rapidly evolves, just like Fedora and Firefox is upgrading itself with new versions every day, no knowledge is permanent; I have to continuously educate myself with up-to-date knowledge.

In the aspect of participating with classmates, unfortunately things that I’ve learned for my project was not relevant to most of other classmates project. Therefore, I’ve only participated with Mark Eamiguel, who is working on “Support beyond armv5tel architecture”, we collaborated with each other by making arrangements on who’s using cdot-beagleXM-0-3 during what times, to avoid interruption on our benchmarks. There was one night our works on that machine became useless since both of us were compiling at the same time which caused performance drop. We also gave each other tips on working with these remote systems, such as using application screen and command who.

Tuesday, December 14, 2010

SBR600: To Thumb? or Not to Thumb? (v0.3)


This is my last entry for Fedora-ARM and SBR600 @ Seneca College project "To Thumb or Not To Thumb?".

When I first read about the project, frankly, I had no idea where to begin from. The company ARM and their chips, guruplugs, beagle boards and Fedora-ARM architecture; all of these were new to me and as I was trying to find connections between them, it became more interesting. So my project Description is as follows,

Fedora-ARM does not use thumb. The purpose of this project is to discover whether thumb provides any significant savings in terms of code size, whether programs compiled to thumb execute more quickly or more slowly than non-thumb programs on common ARM processors, whether a thumb compilation takes more or less time than non-thumb, and whether there are any other factors that would influence the decision to support thumb. Ultimately, this project should make a recommendation on the use of the thumb instruction set for the Fedora-ARM secondary architecture.

What I have done mainly to complete this project was
 - Download different source rpms that are compiled with gcc.
 - Using rpmbuild, recompile the source rpm in Thumb mode.
 - Using rpmbuild, recompile the same source rpm without Thumb mode.
 - Compare if Thumb speeded up the process or not.
 - Compare if Thumb shrunk the file size or not.
 - Compare if applications compiled with Thumb runs faster or not.

I worked alone for this project, using cdot-guru-4-1 (Fedora 13, armv5tel), cdot-beagleXM-0-3 and hongkong.proximity.on.ca at Seneca Centre for Development of Open Technology (CDOT). My project page can be found in Seneca Wiki: To Thumb or Not to Thumb.

Major tools, commands and configuration files I used are
 - rpmbuild
 - /usr/lib/rpm/redhat/rpmrc
 - /usr/lib/rpm/redhat/macros
 - time
 - screen
 - yumdownloader
 - rpm2cpio
 
In the beginning, I compiled, benchmarked and posted my result without understanding rpmbuild fully, wasted tones of time. During my SBR600 class, the professor, Chris Tyler told the class that the directories in rpmbuild are for following purposes.

rpmbuild/SOURCES — Contains the original sources, patches, and icon files.
rpmbuild/SPECS — Contains the spec files used to control the build process.
rpmbuild/BUILD — The directory in which the sources are unpacked, and the software is built.
rpmbuild/RPMS — Contains the binary package files created by the build process.
rpmbuild/SRPMS — Contains the source package files created by the build process.

So here are the file size comparisons after compiling source rpm packages in THUMB, No THUMB and THUMB2. The rpm macro settings were identical except -march=armv5tel, -march=armv5tel -mthumb -mthumb-interwork and -march=armv7 -mthumb.


The numbers inside the table represent file/directory sizes in bytes. File sizes are checked with ll and directory sizes are checked with du --bytes.


nled-2.52
Produced RPM: nled-2.52-6.fc12.armv5tel.rpm
Directories and files: 2 directories, 1 file
Binary File: usr/bin/nled


w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 20776 20204 20328 0.9724 0.9939
Directory 50892 43084 42684 0.8465 1.0093
Binary 38604 30796 30396 0.7977 1.0131


wget-1.11.4
Produced RPM: wget-1.11.4-5.fc12.armv5tel.rpm
Directories and files: 86 directories, 48 files
Binary File: usr/bin/wget


w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 422360 420788 419852 0.9962 1.0022
Directory 1863679 1811467 1810431 0.9719 1.0006
Binary 226464 174252 173216 0.7694 1.0060


httpd-2.2.13
Produced RPM: httpd-2.2.13-4.fc12.armv5tel.rpm
Directories and files: 37 directories, 334 files
Binary File: usr/sbin/httpd


w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 748180 738632 736500 0.9872 1.0029
Directory 2752985 2425373 2408025 0.8810 1.0072
Binary 287988 233660 229712 0.8113 1.0172


gimp-2.6.7
Produced RPM: gimp-2.6.7-2.fc12.armv5tel.rpm
Directories and files: 206 directories, 1204 files
Binary File 1: usr/bin/gimp-2.6
Binary File 2: usr/bin/gimp-console-2.6


w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 12423104 12431184 12350600 1.0006 1.0065
Directory 45780103 43891439 43730427 0.9587 1.0037
Binary 1 4284848 3450936 3371440 0.8054 1.0236
Binary 2 2131228 1688860 1656092 0.7924 1.0198


abiword-2.8.1
Produced RPM: libabiword-2.8.1-1.fc12.armv5tel.rpm
Directories and files: 39 directories, 617 files
Binary File: usr/lib/libabiword-2.8


w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 5561088 4779800 4742828 0.8595 1.0078
Directory 21295155 17055836 16987340 0.8009 1.0040
Binary 5806908 3450936 3371440 0.5943 1.0236


tar-1.22
Produced RPM: tar-1.22-8.fc12.armv5tel.rpm
Directories and files: 79 directories, 49 files
Binary File: bin/tar


w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 744340 742784 742180 0.9979 1.0008
Directory 2737195 2681159 2675975 0.9795 1.0019
Binary 251844 195808 190624 0.7775 1.0272


cpio-2.10
Produced RPM: cpio-2.10-5.fc12.armv5tel.rpm
Directories and files: 49 directories, 30 files
Binary File: bin/cpio
w/o Thumb THUMB THUMB / NON-THUMB
RPM 189908 189276 0.9967
Directory 842194 816194 0.9691
Binary 117064 91064 0.7779


gzip-1.3.12
Produced RPM: gzip-1.3.12-15.fc12.armv5tel.rpm
Directories and files: 9 directories, 33 files
Binary File: bin/gzip
w/o Thumb THUMB THUMB / NON-THUMB
RPM 116560 115736 0.9929
Directory 263922 252086 0.9551
Binary 61708 49872 0.8082


bzip2-1.0.5
Produced RPM: bzip2-1.0.5-6.fc12.armv5tel.rpm
Directories and files: 7 directories, 21 files
Binary File: /usr/bin/bzip2
w/o Thumb THUMB THUMB / NON-THUMB
RPM 49476 49232 0.9951
Directory 109233 103449 0.9470
Binary 33024 28076 0.8502


In average, THUMB reduced the sizes about
2.24% for *.rpm files,
7.67% for extracted directories, and
22.16% for executables, compared to NON-THUMB.
While it might save some disk space for executable files, it doesn't make a big different for rpm packages since rpm has it's own compressing mechanism.

In average, THUMB produced files that are about
0.24% for *.rpm files,
0.45% for extracted directories, and
1.86% for executables, greater than THUMB2.
I noticed that THUMB produces files that are almost as small as THUMB2's products.


In terms of performance of binaries that are built with THUMB and non-THUMB, there weren't too many programs that I could efficiently test in the command line interface.

I've downloaded source code for openoffice (openoffice.org-3.1.1-19.34.fc12.src.rpm), extracted twice to two separate directories, and compiled each one of them with tar binary that was compiled with THUMB, and without THUMB. I've done every test 4 times for better accuracy.

System: cdot-guru-4-1
File: Extracted openoffice.org-3.1.1-19.34.fc12.src.rpm
Command Used: time ./tar -cvf nothumb.tar ~/temp


w/o Thumb THUMB
1st Attempt real 0m33.013s
user 0m0.090s
sys 0m3.800s
real 0m45.746s
user 0m0.170s
sys 0m3.710s
2nd Attempt real 0m38.410s
user 0m0.150s
sys 0m3.860s
real 0m40.039s
user 0m0.130s
sys 0m3.760s
3rd Attempt real 0m37.572s
user 0m0.110s
sys 0m3.820s
real 0m42.034s
user 0m0.140s
sys 0m3.820s
4th Attempt real 0m36.934s
user 0m0.150s
sys 0m3.670s
real 0m43.051s
user 0m0.100s
sys 0m3.830s

The tar that was compiled with THUMB was compressing little bit slower in every attempts. Just to confirm that both tars compressed correctly, I've checked sizes of tarballs.

-rw-rw-r-- 1 thlee3 thlee3 218183680 2010-11-26 10:43 nothumb.tar
-rw-rw-r-- 1 thlee3 thlee3 218183680 2010-11-26 10:41 thumb.tar
And they seemed ok.

As a second test, I've tried decompressing one of the tarballs I created in the first test, using both tars.

System: cdot-guru-4-1
File: nothumb.tar
Command Used: time ~/tar.mthumb-interwork/bin/tar -xvf nothumb.tar


w/o Thumb THUMB
1st Attempt real 0m48.399s
user 0m0.170s
sys 0m3.560s
real 0m54.197s
user 0m0.160s
sys 0m3.480s
2nd Attempt real 0m46.306s
user 0m0.170s
sys 0m3.280s
real 0m48.234s
user 0m0.160s
sys 0m3.680s
3rd Attempt real 0m45.602s
user 0m0.130s
sys 0m3.800s
real 0m49.501s
user 0m0.150s
sys 0m3.490s
4th Attempt real 0m46.546s
user 0m0.110s
sys 0m3.420s
real 0m52.897s
user 0m0.120s
sys 0m3.460s

Again, the tar that was built with THUMB decompressed the tarball little bit slower. I should focus more into performance difference between binaries that are built with THUMB and non-THUMB in this project.

In addition to the benchmark above, I've also compared performances of two bzip2 and gzip that are compiled with/without THUMB.
I extracted & decompressed gimp-2.6.7-2.fc12.armv5tel.rpm file, archived the extracted directory with tar and tried compressing & decompressing using bzip2 and gzips that are compiled with/without THUMB.

System: cdot-guru-4-1
File: gimp.tar (44MB)
Command Used: time ./bzip2 ~/gimp.tar


w/o Thumb THUMB
1st Attempt real    1m4.616s
user    0m59.250s
sys    0m0.650s
real    1m1.379s
user    0m57.240s
sys    0m0.720s
2nd Attempt real    1m4.985s
user    1m0.530s
sys    0m0.790s
real    0m59.899s
user    0m57.190s
sys    0m0.600s
3rd Attempt real    1m5.214s
user    0m58.050s
sys    0m0.620s
real    1m7.306s
user    1m0.100s
sys    0m0.530s
4th Attempt real    1m4.292s
user    0m56.880s
sys    0m0.700s
real    1m4.859s
user    0m57.690s
sys    0m0.770s
5th Attempt real    0m59.811s
user    0m57.520s
sys    0m0.470s
real    1m1.930s
user    0m57.210s
sys    0m0.540s
6th Attempt real    1m3.452s
user    0m57.040s
sys    0m0.590s
real    1m1.532s
user    0m57.930s
sys    0m0.790s
7th Attempt real    1m0.604s
user    0m57.710s
sys    0m0.650s
real    1m2.430s
user    0m57.420s
sys    0m0.730s

For compression with bzip2, it shows almost no difference in performance.


System: cdot-guru-4-1
File: gimp.tar.bz2
Command Used: time ./bzip2 -d ~/gimp.tar.bz2


w/o Thumb THUMB
1st Attempt real    0m18.828s
user    0m17.430s
sys    0m0.820s
real    0m19.662s
user    0m17.850s
sys    0m0.990s
2nd Attempt real    0m19.549s
user    0m17.610s
sys    0m1.160s
real    0m19.647s
user    0m17.940s
sys    0m0.850s
3rd Attempt real    0m19.462s
user    0m17.600s
sys    0m0.950s
real    0m19.271s
user    0m17.620s
sys    0m0.870s
4th Attempt real    0m23.303s
user    0m17.800s
sys    0m0.850s
real    0m22.863s
user    0m17.290s
sys    0m1.120s
5th Attempt real    0m24.544s
user    0m18.120s
sys    0m1.060s
real    0m19.155s
user    0m17.560s
sys    0m1.030s
6th Attempt real    0m19.397s
user    0m17.540s
sys    0m0.800s
real    0m22.998s
user    0m17.400s
sys    0m0.970s
7th Attempt real    0m19.462s
user    0m17.460s
sys    0m1.090s
real    0m19.688s
user    0m17.910s
sys    0m0.870s

Similar to compression, decompression with bzip2 shows no noticeable difference in performance.


System: cdot-guru-4-1
File: gimp.tar
Command Used: time ./gzip ~/gimp.tar


w/o Thumb THUMB
1st Attempt real    0m32.809s
user    0m30.620s
sys    0m0.780s
real    0m35.226s
user    0m33.390s
sys    0m0.770s
2nd Attempt real    0m43.640s
user    0m38.300s
sys    0m0.790s
real    0m38.300s
user    0m34.380s
sys    0m0.650s
3rd Attempt real    0m45.471s
user    0m33.280s
sys    0m0.670s
real    0m42.994s
user    0m36.880s
sys    0m0.710s
4th Attempt real    0m42.212s
user    0m32.690s
sys    0m0.510s
real    0m41.896s
user    0m34.540s
sys    0m0.740s
5th Attempt real    0m43.309s
user    0m31.400s
sys    0m0.740s
real    0m39.998s
user    0m35.240s
sys    0m0.840s
6th Attempt real    0m45.217s
user    0m31.850s
sys    0m0.550s
real    0m39.942s
user    0m34.540s
sys    0m0.670s

The numbers were up and down for compressing with tar. I've actually made about 15 attempts and the results weren't similar at all.



System: cdot-guru-4-1
File: gimp.tar.gz
Command Used: time ./gzip -d ~/gimp.tar.gz


w/o Thumb THUMB
1st Attempt real    0m3.341s
user    0m2.520s
sys    0m0.750s
real    0m3.688s
user    0m3.040s
sys    0m0.530s
2nd Attempt real    0m3.702s
user    0m2.740s
sys    0m0.630s
real    0m4.876s
user    0m2.950s
sys    0m0.650s
3rd Attempt real    0m3.372s
user    0m2.680s
sys    0m0.600s
real    0m4.889s
user    0m2.970s
sys    0m0.580s
4th Attempt real    0m3.512s
user    0m2.760s
sys    0m0.470s
real    0m4.800s
user    0m2.890s
sys    0m0.650s
5th Attempt real    0m4.413s
user    0m2.800s
sys    0m0.470s
real    0m4.016s
user    0m2.930s
sys    0m0.620s
6th Attempt real    0m3.316s
user    0m2.430s
sys    0m0.800s
real    0m4.033s
user    0m2.960s
sys    0m0.640s

The numbers didn't fluctuate as much for decompressing with tar. And it seems that the tar that is compiled with THUMB performs little bit slower overall.


Lastly, I have compared THUMB and NON-THUMB using cpio. I tried archiving same extracted gimp directory as above benchmarks and measured the time.

System: cdot-guru-4-1
File: ~/gimp/ (206 directories, 1204 files)
Command Used: time find ~/gimp/ -depth -print | ./cpio -ov -O ~/gimp.cpio


w/o Thumb THUMB
1st Attempt real    0m7.311s
user    0m0.330s
sys    0m2.300s
real    0m7.432s
user    0m0.290s
sys    0m2.480s
2nd Attempt real    0m8.064s
user    0m0.300s
sys    0m2.460s
real    0m7.574s
user    0m0.230s
sys    0m2.510s
3rd Attempt real    0m6.415s
user    0m0.280s
sys    0m2.430s
real    0m6.954s
user    0m0.300s
sys    0m2.510s
4th Attempt real    0m7.167s
user    0m0.250s
sys    0m2.500s
real    0m7.129s
user    0m0.240s
sys    0m2.520s
5th Attempt real    0m8.562s
user    0m0.220s
sys    0m2.540s
real    0m6.228s
user    0m0.290s
sys    0m2.500s
6th Attempt real    0m6.851s
user    0m0.210s
sys    0m2.580s
real    0m7.883s
user    0m0.240s
sys    0m2.610s
7th Attempt real    0m7.382s
user    0m0.290s
sys    0m2.420s
real    0m7.855s
user    0m0.320s
sys    0m2.430s

2 cpios did not show major difference in performance.


At this point, I came up with a conclusion that THUMB does not greatly effect in software's performance, but it varies depending on software.

I've also made records of the duration rpmbuild took for compiling. I'd like to say that I did not notice any major difference in compiling times, although it'd be hard measure this accurately because compiling durations fluctuated in every attempts I made.


w/o Thumb THUMB
nled real 0m13.701s
user 0m12.190s
sys 0m1.020s
real 0m14.821s
user 0m11.830s
sys 0m1.060s
wget real 3m57.207s
user 3m1.920s
sys 0m40.610s
real 3m59.251s
user 3m0.750s
sys 0m39.810s
gimp real 112m40.989s
user 92m48.050s
sys 10m34.130s
real 110m46.166s
user 90m13.740s
sys 10m32.150s
abiword real 148m58.630s
user 130m32.050s
sys 8m51.320s
real 140m30.739s
user 123m38.600s
sys 8m46.910s


So far I have seen mostly improvement that THUMB makes compared to NO-THUMB. Obviously the numbers of experiments I made are far from being enough to come up with a firm solid answer, but for now, I'm positive that THUMB for Fedora-ARM is worth further development.

Please check out my project page in Seneca Cdot Wiki at

This concludes my project To Thumb? or Not to Thumb? and SBR600 in Seneca College. I would like to thank Chris Tyler and Paul Whalen for all the assistance. It has been a great experience to be in SBR600 and be part of CDOT. Thank you.

Saturday, November 27, 2010

SBR600: To Thumb? or Not to Thumb? (v0.2)

Hi all, this is  version 0.2 of my project, To Thumb? or Not to Thumb?
I'm going to start off with some additional benchmark results.

abiword-2.8.1
Produced RPM: libabiword-2.8.1-1.fc12.armv5tel.rpm
Directories and files: 39 directories, 617 files
Binary File: usr/lib/libabiword-2.8

w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 5561088 4779800 4742828 0.8595 1.0078
Directory 21295155 17055836 16987340 0.8009 1.0040
Binary 5806908 3450936 3371440 0.5943 1.0236


tar-1.22
Produced RPM: tar-1.22-8.fc12.armv5tel.rpm
Directories and files: 79 directories, 49 files
Binary File: bin/tar

w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 744340 742784 742180 0.9979 1.0008
Directory 2737195 2681159 2675975 0.9795 1.0019
Binary 251844 195808 190624 0.7775 1.0272



So based on my benchmarks so far, THUMB reduced the sizes about
3% for *.rpm files,
9% for extracted directories, and
24% for executables, in average.
While it might save some disk space for executable files, it doesn't make a big different for rpm packages since rpm has it's own compressing mechanism.



In terms of performance of binaries that are built with THUMB and non-THUMB, there weren't too many programs that I could efficiently test in the command line interface. For now, I've ran some tests with tar binaries that I compiled.

I've downloaded source code for openoffice (openoffice.org-3.1.1-19.34.fc12.src.rpm), extracted twice to two separate directories, and compiled each one of them with tar binary that was compiled with THUMB, and without THUMB. I've done every test 4 times for better accuracy.

System: cdot-guru-4-1
File: Extracted openoffice.org-3.1.1-19.34.fc12.src.rpm
Command Used: time ./tar -cvf nothumb.tar ~/temp

w/o Thumb THUMB
1st Attempt real 0m33.013s
user 0m0.090s
sys 0m3.800s
real 0m45.746s
user 0m0.170s
sys 0m3.710s
2nd Attempt real 0m38.410s
user 0m0.150s
sys 0m3.860s
real 0m40.039s
user 0m0.130s
sys 0m3.760s
3rd Attempt real 0m37.572s
user 0m0.110s
sys 0m3.820s
real 0m42.034s
user 0m0.140s
sys 0m3.820s
4th Attempt real 0m36.934s
user 0m0.150s
sys 0m3.670s
real 0m43.051s
user 0m0.100s
sys 0m3.830s

The tar that was compiled with THUMB was compressing little bit slower in every attempts. Just to confirm that both tars compressed correctly, I've checked sizes of tarballs.

-rw-rw-r-- 1 thlee3 thlee3 218183680 2010-11-26 10:43 nothumb.tar
-rw-rw-r-- 1 thlee3 thlee3 218183680 2010-11-26 10:41 thumb.tar
And they seemed ok.


As a second test, I've tried decompressing one of the tarballs I created in the first test, using both tars.

System: cdot-guru-4-1
File: nothumb.tar
Command Used: time ~/tar.mthumb-interwork/bin/tar -xvf nothumb.tar

w/o Thumb THUMB
1st Attempt real 0m48.399s
user 0m0.170s
sys 0m3.560s
real 0m54.197s
user 0m0.160s
sys 0m3.480s
2nd Attempt real 0m46.306s
user 0m0.170s
sys 0m3.280s
real 0m48.234s
user 0m0.160s
sys 0m3.680s
3rd Attempt real 0m45.602s
user 0m0.130s
sys 0m3.800s
real 0m49.501s
user 0m0.150s
sys 0m3.490s
4th Attempt real 0m46.546s
user 0m0.110s
sys 0m3.420s
real 0m52.897s
user 0m0.120s
sys 0m3.460s

Again, the tar that was built with THUMB decompressed the tarball little bit slower. I should focus more into performance difference between binaries that are built with THUMB and non-THUMB in this project.



I've also made records of the duration rpmbuild took for compiling. I'd like to say that I did not notice any major difference in compiling times, although it'd be hard measure this accurately because compiling durations fluctuated in every attempts I made.

w/o Thumb THUMB
nled real 0m13.701s
user 0m12.190s
sys 0m1.020s
real 0m14.821s
user 0m11.830s
sys 0m1.060s
wget real 3m57.207s
user 3m1.920s
sys 0m40.610s
real 3m59.251s
user 3m0.750s
sys 0m39.810s
gimp real 112m40.989s
user 92m48.050s
sys 10m34.130s
real 110m46.166s
user 90m13.740s
sys 10m32.150s
abiword real 148m58.630s
user 130m32.050s
sys 8m51.320s
real 140m30.739s
user 123m38.600s
sys 8m46.910s



Some of the difficulties I had while I was working this project are one or more dependencies required for compiling are not available for armv5tel architecture. For example, I was not able to compile openoffice.org because lucene was needed but not yet available. Another challenge was my lack of knowledge in c language and gcc. Once rpmbuild encounters an error in the middle of compiling, it would stop and I wasn't able to make correction in the spec file. I'd like to try compiling mysql and postgresql once I figure this out.


So this concludes my version 0.2. Thank you very much and please stay tuned for version 0.3.

Saturday, November 20, 2010

SBR600: To Thumb? or Not to Thumb? (v0.1) continued.. 4

I have to apologize that, my previous blog entry was incorrect.
I compiled, benchmarked and posted my result without understanding rpmbuild fully.
For those who are unsure about directories rpmbuild uses, here's little description for you that I grabbed from the Internet.

rpmbuild/SOURCES — Contains the original sources, patches, and icon files.
rpmbuild/SPECS — Contains the spec files used to control the build process.
rpmbuild/BUILD — The directory in which the sources are unpacked, and the software is built.
rpmbuild/RPMS — Contains the binary package files created by the build process.
rpmbuild/SRPMS — Contains the source package files created by the build process.

Today, I will post some of my recent benchmark results. In addition to Non-THUMB vs. THUMB, I've compiled with an armv7 chip using THUMB2 mode as well.

All of the compiling was done by rpmbuild, all the rpm macro settings were identical except -march=armv5tel, -march=armv5tel -mthumb -mthumb-interwork and -march=armv7 -mthumb.

The numbers inside the table represent file/directory sizes in bytes. File sizes are checked with ll and directory sizes are checked with du --bytes.


nled-2.52
Produced RPM: nled-2.52-6.fc12.armv5tel.rpm
Directories and files: 2 directories, 1 file
Binary File: usr/bin/nled

w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 20776 20204 20328 0.9724 0.9939
Directory 50892 43084 42684 0.8465 1.0093
Binary 38604 30796 30396 0.7977 1.0131


wget-1.11.4
Produced RPM: wget-1.11.4-5.fc12.armv5tel.rpm
Directories and files: 86 directories, 48 files
Binary File: usr/bin/wget

w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 422360 420788 419852 0.9962 1.0022
Directory 1863679 1811467 1810431 0.9719 1.0006
Binary 226464 174252 173216 0.7694 1.0060


httpd-2.2.13
Produced RPM: httpd-2.2.13-4.fc12.armv5tel.rpm
Directories and files: 37 directories, 334 files
Binary File: usr/sbin/httpd

w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 748180 738632 736500 0.9872 1.0029
Directory 2752985 2425373 2408025 0.8810 1.0072
Binary 287988 233660 229712 0.8113 1.0172


gimp-2.6.7
Produced RPM: gimp-2.6.7-2.fc12.armv5tel.rpm
Directories and files: 206 directories, 1204 files
Binary File 1: usr/bin/gimp-2.6
Binary File 2: usr/bin/gimp-console-2.6

w/o Thumb THUMB THUMB2 THUMB / NON-THUMB THUMB / THUMB2
RPM 12423104 12431184 12350600 1.0006 1.0065
Directory 45780103 43891439 43730427 0.9587 1.0037
Binary 1 4284848 3450936 3371440 0.8054 1.0236
Binary 2 2131228 1688860 1656092 0.7924 1.0198

Tuesday, November 16, 2010

SBR600: To Thumb? or Not to Thumb? (v0.1) continued.. 3




** CONTENT OF THIS ENTRY IS INCORRECT **

A quick update on the some of the benchmarks I did in last 2 days.
The following are the results of compiling with rpmbuild with/without -mthumb on %optflags line inside /usr/lib/rpm/redhat/rpmrc file. I have not yet had a chance to look deeply into the actual compiled binaries.


wget-1.12

None Thumb
11,562,454 bytes for the entire directory.
real 3m57.207s
user 3m1.920s
sys 0m40.610s

With -mthumb
11,451,346 bytes for the entire directory.
real 3m59.251s
user 3m0.750s
sys 0m39.810s

About 0.96% difference in size.


strace-4.5.20

None Thumb
4,460,917 bytes for the entire directory.
real 1m51.975s
user 1m20.490s
sys 0m15.830s

With -mthumb
4,409,508 bytes for the entire directory.
real 1m51.594s
user 1m21.340s
sys 0m15.600s

With -mthumb -mthumb-interwork
4,412,010 bytes for the entire directory.
real 1m58.988s
user 1m21.020s
sys 0m15.860s

About 1.15% difference in size. (When comparing none thumb vs. -mthumb)


gimp-2.6.11

None Thumb
264,625,289 bytes for the entire directory.
real 107m27.884s
user 90m59.410s
sys 9m27.410s

With -mthumb
260,302,061 bytes for the entire directory.
real 106m33.411s
user 89m49.890s
sys 9m29.960s

About 1.63% difference in size.


mysql-5.1.47

None Thumb
392,085,989 bytes for the entire directory.
real 174m54.366s
user 156m4.070s
sys 6m59.270s

With -mthumb
374,269,843 bytes for the entire directory.
real 169m28.554s
user 155m28.730s
sys 6m56.610s


About 4.54% difference in size.



Friday, November 12, 2010

SBR600: To Thumb? or Not to Thumb? (v0.1) continued.. 2

To add some version control for my project, I've started using git.
Will be creating at least one branch in every day that I work on the project.
Today's branch is nov-12.

[thlee3@fedora-arm nled]$ git status
# On branch nov-12
nothing to commit (working directory clean)

So, I've continued with my benchmarking. Today I was mainly compiling using Makefile. Tried experimenting with different -O# option with/without -g.



NLED-2.52 (size of nled file in bytes compiled with different options)

-O -c 
48920
-O -c -mthumb 
40351

-O -c -mthumb -mthumb-interwork
40351

-O2 -c 
48576

-O2 -c -mthumb 
40563

-O2 -c -mthumb -mthumb-interwork
40563

-O -c -g 
95752

-O -c -g -mthumb 
88859

-O -c -g -mthumb -mthumb-interwork
88867

-O2 -c -g 
98128

-O2 -c -g -mthumb 
93115

-O2 -c -g -mthumb -mthumb-interwork
93127



Ended today's work by adding new nled directory and committing to git.

[thlee3@fedora-arm ~]$ git add nled
[thlee3@fedora-arm ~]$ git commit -a -m "Experiments with NLED with different -O switches from Makefile"
[nov-12 66821f4] Experiments with NLED with different -O switches from Makefile
 301 files changed, 69168 insertions(+), 0 deletions(-)
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/Makefile
 create mode 100755 nled/O2_c/nled-2.52-mthumb-interwork/nled
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/nled.c
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/nled.h
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/nled.ico
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/nled.mak
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/nled.nmak
 create mode 100644 nled/O2_c/nled-2.52-mthumb-interwork/nled.o
..
..
.

SBR600: To Thumb? or Not to Thumb? (v0.1) continued..

As I expected, my experiments in the previous blog post (To Thumb? or Not to Thumb? v0.1) were incorrect.
The problem was that for whatever reason (which I haven't yet figured out why), the macros were called from somewhere else in the system.

The file where rpmbuild looked for %optflags was /usr/lib/rpm/redhat/rpmrc instead of /usr/lib/rpm/platform/armv5tel-linux/macros.



















And __global_cflags was called from /usr/lib/rpm/redhat/macros.



















The change in __global_cflags macro was necessary because -O# switch would probably effect the file size and the compile speed. Also, I wanted to get rid of -g switch to save time by not including debugging info.

So here is the result of today's benchmark I did for nled-2.52.

nothumb
real 0m13.701s
user 0m12.190s
sys 0m1.020s

real 0m13.664s
user 0m12.140s
sys 0m1.080s

real 0m13.955s
user 0m12.150s
sys 0m1.140s

mthumb
real 0m13.533s
user 0m11.850s
sys 0m1.040s

real 0m14.821s
user 0m11.830s
sys 0m1.060s

real 0m13.292s
user 0m11.740s
sys 0m1.110s

mthumb mthumb-interwork
real 0m15.665s
user 0m11.780s
sys 0m1.050s

real 0m15.651s
user 0m11.970s
sys 0m0.950s

real 0m13.292s
user 0m11.670s
sys 0m1.170s



[thlee3@fedora-arm ~]$ ls -l rpmbuild/BUILD/nled-2.52-none/*.o
-rw-r--r-- 1 thlee3 thlee3 8248 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledata.o
-rw-r--r-- 1 thlee3 thlee3 10320 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledio.o
-rw-r--r-- 1 thlee3 thlee3 8712 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledisp.o
-rw-r--r-- 1 thlee3 thlee3 7536 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledit.o
-rw-r--r-- 1 thlee3 thlee3 10676 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nledmisc.o
-rw-r--r-- 1 thlee3 thlee3 14988 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nled.o
-rw-r--r-- 1 thlee3 thlee3 4296 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/qkdisp.o
TOTAL BINARY SIZE: 64776



[thlee3@fedora-arm ~]$ ls -l rpmbuild/BUILD/nled-2.52-mthumb/*.o
-rw-r--r-- 1 thlee3 thlee3 6732 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledata.o
-rw-r--r-- 1 thlee3 thlee3 9240 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledio.o
-rw-r--r-- 1 thlee3 thlee3 7376 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledisp.o
-rw-r--r-- 1 thlee3 thlee3 6400 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledit.o
-rw-r--r-- 1 thlee3 thlee3 9736 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nledmisc.o
-rw-r--r-- 1 thlee3 thlee3 13652 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nled.o
-rw-r--r-- 1 thlee3 thlee3 4220 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/qkdisp.o 
TOTAL BINARY SIZE:  57356


[thlee3@fedora-arm ~]$ ls -l rpmbuild/BUILD/nled-2.52-mthumb-interwork/*.o
-rw-r--r-- 1 thlee3 thlee3 6732 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledata.o
-rw-r--r-- 1 thlee3 thlee3 9240 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledio.o
-rw-r--r-- 1 thlee3 thlee3 7376 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledisp.o
-rw-r--r-- 1 thlee3 thlee3 6400 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledit.o
-rw-r--r-- 1 thlee3 thlee3 9736 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nledmisc.o
-rw-r--r-- 1 thlee3 thlee3 13652 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nled.o
-rw-r--r-- 1 thlee3 thlee3 4220 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/qkdisp.o
TOTAL BINARY SIZE:  57356

For nled, there was no difference between -mthumb and -mthumb -mthumb-interwork in terms of file size. But Thumb compiled the binary 11.5% smaller than non-Thumb. This was with -O2.

The size of the entire directory including the program, debugging and docs.

[thlee3@fedora-arm ~]$ du -h rpmbuild/BUILD/
368K rpmbuild/BUILD/nled-2.52-mthumb
368K rpmbuild/BUILD/nled-2.52-mthumb-interwork
388K rpmbuild/BUILD/nled-2.52-none
1.2M rpmbuild/BUILD/

And here are some additional detailed compiling info.
NONE THUMB
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.zV0HzL
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.seL1Lr
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nled.o nled.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledisp.o nledisp.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledit.o nledit.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledio.o nledio.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledmisc.o nledmisc.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o nledata.o nledata.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te  -c -o qkdisp.o qkdisp.c
cc -o nled nled.o nledisp.o nledit.o nledio.o \
         nledmisc.o nledata.o qkdisp.o -lcurses
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.zSV2St
extracting debug info from /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.arm/usr/bin/nled
Processing files: nled-2.52-6.fc12.armv5tel
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux.so.3 ld-linux.so.3(GLIBC_2.4) libc.so.6 libc.so.6(GLIBC_2.4) libgcc_s.so.1 libgcc_s.so.1(GCC_3.5) libncurses.so.5 libtinfo.so.5 rtld(GNU_HASH)
Processing files: nled-debuginfo-2.52-6.fc12.armv5tel
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.arm
Wrote: /home/thlee3/rpmbuild/SRPMS/nled-2.52-6.fc12.src.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-2.52-6.fc12.armv5tel.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-debuginfo-2.52-6.fc12.armv5tel.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.B7GI93

-mthumb
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.se1pq7
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.YXHtHe
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nled.o nled.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledisp.o nledisp.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledit.o nledit.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledio.o nledio.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledmisc.o nledmisc.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o nledata.o nledata.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb -c -o qkdisp.o qkdisp.c
cc -o nled nled.o nledisp.o nledit.o nledio.o \
         nledmisc.o nledata.o qkdisp.o -lcurses
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.o8GtKj
extracting debug info from /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm/usr/bin/nled
Processing files: nled-2.52-6.fc12.mthumb.armv5tel
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux.so.3 ld-linux.so.3(GLIBC_2.4) libc.so.6 libc.so.6(GLIBC_2.4) libgcc_s.so.1 libgcc_s.so.1(GCC_3.5) libncurses.so.5 libtinfo.so.5 rtld(GNU_HASH)
Processing files: nled-debuginfo-2.52-6.fc12.mthumb.armv5tel
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm
Wrote: /home/thlee3/rpmbuild/SRPMS/nled-2.52-6.fc12.mthumb.src.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-2.52-6.fc12.mthumb.armv5tel.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-debuginfo-2.52-6.fc12.mthumb.armv5tel.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.0DqX9f


-mthumb -mthumb-interwork
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.oYmHeB
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.YJCHV9
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nled.o nled.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledisp.o nledisp.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledit.o nledit.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledio.o nledio.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledmisc.o nledmisc.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o nledata.o nledata.c
cc -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv5te -mthumb-interwork -c -o qkdisp.o qkdisp.c
cc -o nled nled.o nledisp.o nledit.o nledio.o \
         nledmisc.o nledata.o qkdisp.o -lcurses
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.3TroEh
extracting debug info from /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm/usr/bin/nled
Processing files: nled-2.52-6.fc12.mthumb.armv5tel
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux.so.3 ld-linux.so.3(GLIBC_2.4) libc.so.6 libc.so.6(GLIBC_2.4) libgcc_s.so.1 libgcc_s.so.1(GCC_3.5) libncurses.so.5 libtinfo.so.5 rtld(GNU_HASH)
Processing files: nled-debuginfo-2.52-6.fc12.mthumb.armv5tel
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/thlee3/rpmbuild/BUILDROOT/nled-2.52-6.fc12.mthumb.arm
Wrote: /home/thlee3/rpmbuild/SRPMS/nled-2.52-6.fc12.mthumb.src.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-2.52-6.fc12.mthumb.armv5tel.rpm
Wrote: /home/thlee3/rpmbuild/RPMS/armv5tel/nled-debuginfo-2.52-6.fc12.mthumb.armv5tel.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.RVsZ5H



* ADDITIONAL INFO ADDED on 11/12/2010
[thlee3@fedora-arm ~]$ ls -la rpmbuild/BUILD/nled-2.52-none/nled
-rwxr-xr-x 1 thlee3 thlee3 50449 2010-11-12 01:37 rpmbuild/BUILD/nled-2.52-none/nled

 
[thlee3@fedora-arm ~]$ ls -la rpmbuild/BUILD/nled-2.52-mthumb/nled
-rwxr-xr-x 1 thlee3 thlee3 42676 2010-11-12 01:38 rpmbuild/BUILD/nled-2.52-mthumb/nled


[thlee3@fedora-arm ~]$ ls -la rpmbuild/BUILD/nled-2.52-mthumb-interwork/nled
-rwxr-xr-x 1 thlee3 thlee3 42676 2010-11-12 01:49 rpmbuild/BUILD/nled-2.52-mthumb-interwork/nled