Word up!
If there are any gcc users here, maybe you could help me out. I have a
program and I've tried compiling it with -O2 and -O3 optimization
settings.
The wired thing is that it actually runs faster with -O2 than with -O3,
even though -O3 is a higher optimization setting.
Have I found a bug in gcc? Could I be doing something wrong?
Cheers.
Jan 15 '08
29 1909
On Wed, 16 Jan 2008 05:24:07 -0600, Joachim Schmitz wrote
(in article <fm**********@o nline.de>):
Kelsey Bjarnason wrote:
>On Wed, 16 Jan 2008 00:43:25 +0100, sammy wrote:
>>Word up!
If there are any gcc users here, maybe you could help me out. I have a program and I've tried compiling it with -O2 and -O3 optimization settings.
The wired thing is that it actually runs faster with -O2 than with -O3, even though -O3 is a higher optimization setting.
Have I found a bug in gcc? Could I be doing something wrong?
One point to ponder, which isn't specific to gcc but to optimisation in general...
Many optimisations consume more space than the less optimised code. Loop unrolling, for example, can do this. While this _can_ result in faster code, it can _also_ potentially result in side effects such as exhausting the cache memory. The net result can be a significant slowdown.
This sort of thing isn't really a bug; the optimiser has no way to know what machines the code will run on.
If not the compiler/optimizer, who else?
How can it possibly know which computer(s) you will install and run it
on after it is compiled?
Not every program is something for you to play with for a bit in ~/src
then forget about. ;-)
--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw
On Wed, 16 Jan 2008 06:47:46 -0600, Rui Maciel wrote
(in article <47************ ***********@new s.telepac.pt>):
Kelsey Bjarnason wrote:
>This sort of thing isn't really a bug; the optimiser has no way to know what machines the code will run on.
If the compiler writers think that this is relevant and they need to figure
out a way to know any property of the target machine, couldn't they simply
add an option that enables the user to specify those target properties?
Some provide switches to optimize for different "families" of
processors. The problem is, it doesn't allow for any new hardware that
comes along after the compile is completed or after the compiler was
written. Also, it doesn't allow for a binary to be used on multiple
hardware platforms from the same build while enjoying this special
attention.
--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw
On Wed, 16 Jan 2008 09:26:23 -0600, jacob navia wrote
(in article <fm**********@a ioe.org>):
Within lcc-win, I have targeted only ONE optimization strategy:
Code size.
There is nothing that runs faster than a deleted instruction.
<shakes head>
#include "examples of loop unrolling improving performance"
I wonder if everyone using lcc-win today realize just how narrow your
view on optimization is?
--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw
Randy Howard wrote:
On Wed, 16 Jan 2008 09:26:23 -0600, jacob navia wrote
(in article <fm**********@a ioe.org>):
>Within lcc-win, I have targeted only ONE optimization strategy:
Code size.
There is nothing that runs faster than a deleted instruction.
<shakes head>
#include "examples of loop unrolling improving performance"
I wonder if everyone using lcc-win today realize just how narrow your
view on optimization is?
Can you explain the results ?
Of course it is narrow. It is a Reduced Optimization Set Compiler
(ROSC).
Jokes aside, obviously for you, the results aren't important but...
what?
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
Randy Howard wrote:
Some provide switches to optimize for different "families" of
processors. Â*The problem is, it doesn't allow for any new hardware that
comes along after the compile is completed or after the compiler was
written. Â*Also, it doesn't allow for a binary to be used on multiple
hardware platforms from the same build while enjoying this special
attention.
That isn't exactly a compiler problem, is it?
Rui Maciel
On Jan 16, 11:34*am, Randy Howard <randyhow...@FO OverizonBAR.net >
wrote:
On Wed, 16 Jan 2008 05:24:07 -0600, Joachim Schmitz wrote
(in article <fmkpgn$v3...@o nline.de>):
Kelsey Bjarnason wrote:
On Wed, 16 Jan 2008 00:43:25 +0100, sammy wrote:
>Word up!
>If there are any gcc users here, maybe you could help me out. I have a program and I've tried compiling it with -O2 and -O3 optimization settings.
>The wired thing is that it actually runs faster with -O2 than with -O3, even though -O3 is a higher optimization setting.
>Have I found a bug in gcc? Could I be doing something wrong?
One point to ponder, which isn't specific to gcc but to optimisation
in general...
Many optimisations consume more space than the less optimised code.
Loop unrolling, for example, can do this. *While this _can_ result in
faster code, it can _also_ potentially result in side effects such as
exhausting the cache memory. *The net result can be a significant
slowdown.
This sort of thing isn't really a bug; the optimiser has no way to
know what machines the code will run on.
If not the compiler/optimizer, who else?
How can it possibly know which computer(s) you will install and run it
on after it is compiled? *
GCC aside:
-march is supposed to be a promise of that. If you run it on
something else then you won't get the sort of performance you were
hoping for. Many other compilers have this same sort of effect (even
producing code that will only run on certain CPUs in some instances).
Not every program is something for you to play with for a bit in ~/src
then forget about. *;-)
Rats. How deflating.
Randy Howard wrote:
On Wed, 16 Jan 2008 05:24:07 -0600, Joachim Schmitz wrote
(in article <fm**********@o nline.de>):
>>This sort of thing isn't really a bug; the optimiser has no way to know what machines the code will run on.
If not the compiler/optimizer, who else?
How can it possibly know which computer(s) you will install and run it
on after it is compiled?
The optimizer could run on the target machine, so "this one"
would be the appropriate answer.
[Warning: mere possibility isn't evidence of implementation.]
--
Contains Billion-Year-Old Materials Hedgehog
Otherface: Jena RDF/Owl toolkit http://jena.sourceforge.net/
Chris Dollin wrote:
Randy Howard wrote:
>On Wed, 16 Jan 2008 05:24:07 -0600, Joachim Schmitz wrote (in article <fm**********@o nline.de>):
>>>This sort of thing isn't really a bug; the optimiser has no way to know what machines the code will run on. If not the compiler/optimizer, who else?
How can it possibly know which computer(s) you will install and run it on after it is compiled?
The optimizer could run on the target machine, so "this one"
would be the appropriate answer.
[Warning: mere possibility isn't evidence of implementation.]
Shipping the optimizer with your application?
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
On Wed, 16 Jan 2008 15:48:56 -0600, user923005 wrote
(in article
<d1************ *************** *******@z17g200 0hsg.googlegrou ps.com>):
On Jan 16, 11:34*am, Randy Howard <randyhow...@FO OverizonBAR.net >
wrote:
>>
>>>This sort of thing isn't really a bug; the optimiser has no way to know what machines the code will run on. If not the compiler/optimizer, who else?
How can it possibly know which computer(s) you will install and run it on after it is compiled? *
GCC aside:
-march is supposed to be a promise of that. If you run it on
something else then you won't get the sort of performance you were
hoping for. Many other compilers have this same sort of effect (even
producing code that will only run on certain CPUs in some instances).
I think you missed what I was saying there. You can optimize with
something like -march for a specific hardware type, but when you move
that binary to other machines it isn't a promise of anything, it may
not even run properly.
--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw
On 16 Jan 2008 at 22:20, jacob navia wrote:
Chris Dollin wrote:
>The optimizer could run on the target machine, so "this one" would be the appropriate answer.
[Warning: mere possibility isn't evidence of implementation.]
Shipping the optimizer with your application?
Yes, though that rather depends on shipping the source code with your
application too, so it wouldn't be much use for closed-source programs
like lcc-win for example... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew |
last post by:
Where can one find a discussion of the current and future optimizations that the C# compilers do? When I see things like the following I question my faith in csc being good at optimizing. The same kind of thing shows up in cordbg when looking at the JIT code for a similar example
% cat y.c
using System
class A
bool On { get { return true; }
public void Print()
if (On)
|
by: JKop |
last post by:
I'm looking for a compiler, I'm running Windows XP. Can anyone suggest a
good one that can output assembly and that has all sorts of good
optimizations in it, all sorts of bells and whistles. I'm using Dev C++ at
the moment, but it has approximately 9999999999999999999999999999999 bugs in
it, so if anyone can suggest a decent environment too, I'll be appreciative.
-JKop
|
by: joshc |
last post by:
I'm writing some C to be used in an embedded environment and the code
needs to be optimized. I have a question about optimizing compilers in
general. I'm using GCC for the workstation and Diab compiler for the
embedded target.
My question is about how compilers optimize certain code sequences.
As an example, take the code below. Will the compiler eliminate the
actual function call to foo() in the object code generated and just
store...
|
by: VM |
last post by:
Hello,
I'm looking for information on C# compiler optimization or compilation for
an engineering short paper I want to write. Any sites with some technical
info on the new advances of C# compilation would be greatly appreciated.
Any sites that have comparisons between C# compilation an any other language
would be even better.
My email is : MYERSV at GO dot COM
|
by: babak |
last post by:
Hi
I am running a project in eVC 4.0 and I have been running into a bug
that only appears in the release build of the project. I eventually
found out that when I had the compiler option /Od set the project would
work properly but when it was not set the bug would appear.
I looked for /Od in the MSDN library but it didn't provide much help.
Can anyone help me with what in my code that could lead to this? I.e
what should I look for in my...
| |
by: Don Kim |
last post by:
Ok, so I posted a rant earlier about the lack of marketing for C++/CLI,
and it forked over into another rant about which was the faster
compiler. Some said C# was just as fast as C++/CLI, whereas others said
C++/CLI was more optimized.
Anyway, I wrote up some very simple test code, and at least on my
computer C++/CLI came out the fastest. Here's the sample code, and just
for good measure I wrote one in java, and it was the slowest! ;-)...
|
by: Mark Dufour |
last post by:
Hello all,
As Bearophile pointed out, I have just released Shed Skin 0.0.8. For
those of you that do not know Shed Skin, it is an optimizing
Python-to-C++ compiler, that allows for translation of pure
(unmodified) Python programs into optimized machine language. The
speed of generated code is typically 2-40 times, 12 on average, faster
than when using Psyco, and 2-220 times, 45 on average, than when using
CPython, for a sizeable set of...
|
by: wkaras |
last post by:
I've compiled this code:
const int x0 = 10;
const int x1 = 20;
const int x2 = 30;
int x = { x2, x0, x1 };
struct Y
{
|
by: llothar |
last post by:
Does anybody have some benchmarks or links to articles that compare
this for different compiler implementations?
I would especially like to see if it is usefull on MSVC, Intel 9.0 C
and gcc.
Also what is about the effect of "interprocedural optimization".
All my use cases are 98% integer performance dominated. Currently i
only use -O2 or -O3 for MSVC and gcc but i would really like to now if
it is worth to spend time on optimization...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |