compiler: optimize for size?

Share your compiler knowledge

Moderators: Joyce, Laura, Eminent-Admin

compiler: optimize for size?

Postby MartinHerrman » 16 Jan 2011, 20:12

The C/C++ compiler flags can be used with different optimizations (e.g. -O0, .., -O3, -Os). What is best for the EM7075?
(I know that these optimizations can result in compile errors)
User avatar
MartinHerrman
Forum Supporter
 
Posts: 99
Joined: 08 May 2010, 11:24

Re: compiler: optimize for size?

Postby Alex » 17 Jan 2011, 11:52

Ask the guys who built the compiler :)

For me, -Os produces nicely sized and working executables though.
Forum rules: viewtopic.php?t=4
Using Mediainfo: viewtopic.php?t=1110
Telnet: viewtopic.php?t=1873
Alex
Forum Goddess
 
Posts: 1799
Joined: 12 Nov 2009, 13:05

Re: compiler: optimize for size?

Postby MartinHerrman » 17 Jan 2011, 14:00

For me it worked out at least for unrar :-) Binary really is smaller, but I did not do any (performance) testing. I might do that soon. From your reply I understand that you do not know of any factury recommendations or benchmark results.
User avatar
MartinHerrman
Forum Supporter
 
Posts: 99
Joined: 08 May 2010, 11:24

Re: compiler: optimize for size?

Postby MartinHerrman » 17 Jan 2011, 23:48

I just finished my last test. The results surprised me. A lot.

Test-setup:
- 700MB avi
- using winrar 3.93 32-bit for windows xp
- split the archive in 100MB parts using 'good' compression method
- running official firmware 2.0.0.13
- wd elements external harddrive, 2 gb, ext3 filesystem
- samba and rtorrent running, but no activity
- self-compiled unrar is on external harddisk
- 1 measurement per case
- wait for scan_manager to finish in between runs. It detects a new file.
- unrar e file.part1.rar

I monitor cpu usage and memory usage using 'top'. 'time' is used to measure time used for executing the command. Memusage appears to be constant during execution, but cpu-usage varies a bit. That makes the measurement less precise.

Code: Select all
Unrar version      size (bytes)   memusage (%)   cpu usage (%)   time (real, user, sys)

2.0.0.13 v3.90      345640      8.7      93-97      10m41s, 9m49s, 0m22s
default   v4.0      358288       8.9      93-97      10m12s, 9m22s, 0m22s
-Os v4.0         214432       8.8      90-95       3m50s, 3m12s, 0m21s
-O2 v4.0         234528       8.8      89-95       3m28s, 2m49s, 0m21s


This is a cpu-intensive application, which also has quite some disk i/o. To me -O2 is a clear winner. But I know that results vary depending on the type of application. On the other hand: the difference between -Os and -O2 can be neglected when you relate it to the difference between default and any of these two optimizations.
User avatar
MartinHerrman
Forum Supporter
 
Posts: 99
Joined: 08 May 2010, 11:24


Return to EM7075 - Cross-compiling issues & tips

Who is online

Users browsing this forum: No registered users and 0 guests

cron