LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 10-26-2007, 08:24 PM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 616

Rep: Reputation: 32
Question What does optimizing for size mean?


While compiling my kernel with menuconfig I came across a setting that is:

[]Optimize for size (look out for broken compilers!)

What exactly does this setting do?
 
Old 10-26-2007, 09:28 PM   #2
Hendronicus
Member
 
Registered: Feb 2006
Location: Oldsmar, Fl. USA
Distribution: Slackware, Ubuntu
Posts: 173

Rep: Reputation: 38
I tried it once and it used the -Os flag instead of the usual -O2 flag. From the GCC manpage :
Quote:
-Os Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
My guess, and it is only a guess, is that those further optimizations are redundancy suppressions and relocation hacks, which is why old (broken) compilers will choke. They won't be able to relocate some of the assembly routines.
 
Old 10-27-2007, 01:38 AM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by Hendronicus View Post
I tried it once and it used the -Os flag instead of the usual -O2 flag.
Did you see any difference in the performance of the system? I'm using a P4 prescott core that has 1MB of full speed cache... I'm guessing it's ok with -O2 but if you see a difference...
 
Old 10-27-2007, 04:03 AM   #4
Hendronicus
Member
 
Registered: Feb 2006
Location: Oldsmar, Fl. USA
Distribution: Slackware, Ubuntu
Posts: 173

Rep: Reputation: 38
No, not really. I used it for a while but now I'm just back to the regular setting. I think it's really a setting more for embedded kernels than for the desktop. It did make my kernel about ~700K smaller, your mileage may vary. I'll bet the real difference is in module sizes. Loop unrolling and things like that would make them individually larger and sometimes that can add up. I didn't check those, though.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
optimizing c andystanfordjason Programming 6 01-13-2007 09:38 PM
dd optimizing via netcat? Linux_Kidd Linux - General 2 01-03-2007 01:08 PM
optimizing fc5 epoo Fedora 2 05-27-2006 08:16 PM
Optimizing Mandrake rokka Mandriva 9 12-14-2004 08:21 PM
Optimizing Memory PionexUser Linux - Newbie 3 12-05-2004 11:34 AM


All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration