Unix Technical Forum

Compiling : optimizing for CPU ?

This is a discussion on Compiling : optimizing for CPU ? within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Hello, When creating a package for own usage (so it doesn't need to be portable), is it interessant to ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 02:40 PM
Gauthier
 
Posts: n/a
Default Compiling : optimizing for CPU ?


Hello,

When creating a package for own usage (so it doesn't need to be
portable), is it interessant to specify a particular architecture with
the -mcpu=cpu-type and -march=cpu-type of gcc instead of the default
386 ?

Is it really a gain in speed, or other advantage ?

Thanks in advance,
--
^^ Gauthier
(_____/°°-ç
| \_`-"
)/@mmm||
\nn \nn FOE-Belgium : http://www.amisdelaterre.be
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 02:40 PM
Menno Duursma
 
Posts: n/a
Default Re: Compiling : optimizing for CPU ?

On Thu, 12 Aug 2004 18:15:30 +0000, Gauthier wrote:

> Hello,
>
> When creating a package for own usage (so it doesn't need to be
> portable), is it interessant to specify a particular architecture with
> the -mcpu=cpu-type and -march=cpu-type of gcc instead of the default
> 386 ?


Probably: yes.

> Is it really a gain in speed,


Between i386 and i686 it /is/ for most things. However behond that: not
much. IME though, i586 as opposed to i486 doesn't generally gain much.

> or other advantage ?


Idunno.

> Thanks in advance,


Well, you might want to use "-O2". And "strip" the generated binaries.
Other then that, some specific programs doing math stuff gain some speed
from setting: MMX, 3D-Now, SSE, or whatever, options.

--
-Menno.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 02:44 PM
Menno Duursma
 
Posts: n/a
Default Re: Compiling : optimizing for CPU ?

On Thu, 12 Aug 2004 19:49:31 +0000, Menno Duursma wrote:
> On Thu, 12 Aug 2004 18:15:30 +0000, Gauthier wrote:


[ GCC flags ]

>> or other advantage ?

>
> Idunno.


Thinking about this ... : if given program is to be run on a security
boundary (suid/sgid, daemon, kernel, etc) it might make writing an
exploit, for some vulnerability in it, somewhat harder. As such
"optimizing" may (in some cases) be considerd an obscurety measure.

Assuming here: the binary doesn't have the "readable" bit set for view
(from the atackers previlege level) they'd probably have to guess an ofset.

HTH.

--
-Menno.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com