LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-12-2014, 06:46 AM   #1
Kingtiger01
Member
 
Registered: Nov 2006
Distribution: ArchLinux
Posts: 59

Rep: Reputation: 16
Compiler Optimization questions.


(Moderators, if this is the wrong section please move it)

Code:
Compiler Group:GCC(GCC/GCJ/CPP)
Platform:x86_64{Intel(Core2duo) & AMD(Bulldozer/amdfam10)}
Hello All!

I had a few questions regarding compiler optimization.

1. Do switches effect binary/library performance? or just compile-time performance. examples:
Code:
-03 
-march=(ex:amdf10)
2. What switches are avalible for GCC, GCJ and CPP. What do they do?

3. Is there any other Compilers for C&C++ on Linux, and what are there benefits?
 
Old 04-12-2014, 08:26 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
By default, GCC will compile for your environment (the installed processor). It is also a cross-compiler and you can optionally specify a particular processor target.

Optimization is for run-time, not for compile time. Generally, GCC does a pretty good job of optimizing your code and you can, if you wish, chose multiple levels of optimization (which may or may not be effective depending on your code and other factors).

As to switches, well, there are a large number of them and a description of each is beyond the scope of this post; have a look at http://linux.die.net/man/1/gcc. Of course, if you're running a Linux system, the manual page (and info page) are available via the man gcc utility. Bear in mind that the optional switches are for particular purposes and you need to have a clear understanding of what they do (from the documentation); generally, it's reasonable to use the defaults.

There are other compilers available, notably the Intel compiler; however, the Intel compiler is "pay for" and it is expensive and may not be compatible with your Linux system in all ways. If you have special needs, the Intel compiler may be a benefit but for general use on a Linux platform probably not.

Hope this helps some.

Last edited by tronayne; 04-12-2014 at 08:29 AM.
 
Old 04-19-2014, 10:50 PM   #3
Kingtiger01
Member
 
Registered: Nov 2006
Distribution: ArchLinux
Posts: 59

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by tronayne View Post
By default, GCC will compile for your environment (the installed processor). It is also a cross-compiler and you can optionally specify a particular processor target.

Optimization is for run-time, not for compile time. Generally, GCC does a pretty good job of optimizing your code and you can, if you wish, chose multiple levels of optimization (which may or may not be effective depending on your code and other factors).
I kind of figured that, but i just wanted to clarify.

The build environment is GNU/Linux, but this is for distribution. So im trying to cross-compile for Intel(Haswell) and AMD(Bulldozer) platforms. Generic targets loose 3-51% due to run-time optimization on some applications.

Ill research more into alternative(targeted) compilers though, but i have a starting point. - Ill list this as solved within 3 weeks, as im waiting for a second opinion, if none in 3weeks then ill list solved automatically.
 
  


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
Applying optimization recursively by compiling again using optimization flags $u$hil_k$ Linux - General 1 11-18-2013 12:19 PM
LXer: LLVM Clang 3.4 SVN Compiler Optimization Level Tests LXer Syndicated Linux News 0 07-31-2013 04:10 AM
Compiler questions (g++ specific) zensunni Programming 4 03-10-2008 10:06 AM
gcc compiler optimization question dcfnef Programming 2 01-17-2007 07:58 AM
compiler questions rioguia Linux - Software 2 09-12-2002 12:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:35 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