LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2010, 04:49 AM   #1
amarg
LQ Newbie
 
Registered: Mar 2008
Posts: 12

Rep: Reputation: 0
Set optimization Flag -o3


Hi All,

I am looking for the details for C complilation Flag -o3.
Please let me know if some can can help or let me know where I can find details (other than man page). I am looking for pratical examples like why -o3 Flag is used etc.

Thanks,
Amar
 
Old 09-18-2010, 04:53 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 988
Blog Entries: 4

Rep: Reputation: 254Reputation: 254Reputation: 254
Greetingz!

For the specifics about -O3, check here. It's a section of the main GCC documentation.
Basically, it's the same as -O2, but "more intense".

EDIT: That documentation details exactly what flags are enabled. The -O# series of compilation options being 'aliases' to a predefined set of flags. The documentation goes over each of the individual flags as well.

2nd EDIT: As for why anyone would willing set -O3, its because we like to squeeze every drop of blood performance out of our code (or we like watching things explode).

Last edited by xeleema; 09-18-2010 at 05:06 AM.
 
Old 09-18-2010, 02:56 PM   #3
ryozaui
LQ Newbie
 
Registered: Sep 2010
Posts: 2

Rep: Reputation: 0
"Note that -O2 is regarded as safer than '-O3', and '-O3' can often be a counter-productive attempt at optimization."

http://en.gentoo-wiki.com/wiki/Safe_Cflags

Also:

"The behavior of gcc has changed significantly since version 3.x. In 3.x, -O3 has been shown to lead to marginally faster execution times over -O2, but this is no longer the case with gcc 4.x."

http://www.gentoo.org/doc/en/gcc-optimization.xml

Read these two references carefully.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set boot flag on USB through the terminal? linus72 Linux - Newbie 10 08-10-2010 12:18 PM
I am unable to set immutable flag in SuSE udayakumarsv SUSE / openSUSE 1 03-30-2009 11:34 PM
how to set O_NONBLOCK flag retroactivaly jf.argentino Programming 10 04-25-2008 02:11 PM
How to add flag to inode i_flags and how to set it devkpict Linux - Kernel 3 12-06-2007 11:41 PM
I'm Having Trouble Trying to Manually Set Cap_Sys_Nice Flag... paintballer1016 Linux - General 3 07-19-2007 07:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 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
Open Source Consulting | Domain Registration