Hello,
I need help in removing if ..else conditions inside for loops. I have
used the following method but I am not sure whether it has actually
helped.
Below is an example to illustrate what I have used.
Original code :
c= 0 ;
for (i=0; i<999; i++)
{
if (a > B)
c++ ;
}
Modified code for speed optimization
c= 0 ;
for (i=0; i<999; i++)
{
c += (a > B) ;
}
As per my reasoning, the logical expression is evaluated but no
conditional branching instructions should be generated. This should
avoid any pipeline stalls.
However, I havent found any document confirming my belief !
Any comments, suggestions or references will be a big help !
Thanks & Regards 24 8487
"Kunal" <ku*************@gmail.com> writes: I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
The only way you can find out whether this makes a difference is
by measuring. My guess is that it will make no difference with
most compilers.
Note that the evaluation of `a > b' may itself require a branch.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
"Kunal" <ku*************@gmail.com> writes: I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls. However, I havent found any document confirming my belief ! Any comments, suggestions or references will be a big help !
You're assuming that the code generated for (a > B) won't involve any
conditional branches.
Any decent compiler is likely to generate similar or identical code
for both forms.
It's usually best to write your code as clearly as possible and let
the compiler worry about micro-optimization. Attempting to do
low-level optimization yourself is likely to make the compiler's job
more difficult.
First rule of optimization: Don't do it.
Second rule of optimization (advanced users only): Don't do it yet.
If you really need to do this kind of micro-optimization, perhaps
because the loop is in a performance-critical part of your program
(because you've measured it), you can probably examine the assembly
language generated by your compiler -- or you can write the code in
assembly language yourself.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
In article <11**********************@g14g2000cwa.googlegroups .com>,
"Kunal" <ku*************@gmail.com> wrote: Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls.
Did you measure how long it takes?
The most important rule of optimisation: Don't optimise until you have
measured it.
(There are several most important rules of optimisation, this is just
one of them. I bet some more will be posted. This one always applies:
Never, ever optimise without measuring. )
Kunal wrote On 12/05/05 17:02,: Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
Even faster (probably):
c = (a > B) ? 999 : 0;
i = 999;
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls. However, I havent found any document confirming my belief ! Any comments, suggestions or references will be a big help !
See Ben Pfaff's response.
-- Er*********@sun.com
On 2005-12-05, Eric Sosman <er*********@sun.com> wrote:
Kunal wrote On 12/05/05 17:02,: Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
Even faster (probably):
c = (a > B) ? 999 : 0; i = 999;
Though presumably he was doing more in the loop, you're correct.
Jordan Abel wrote On 12/05/05 18:00,: On 2005-12-05, Eric Sosman <er*********@sun.com> wrote:
Kunal wrote On 12/05/05 17:02,:
Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
Even faster (probably):
c = (a > B) ? 999 : 0; i = 999;
Though presumably he was doing more in the loop, you're correct.
That was the point I was trying to make, indirectly:
It's silly to micro-optimize pseudocode. If the O.P.
responds to my tongue-in-cheek suggestion by showing us
what's actually going on in the loop, we might have some
better ideas about how to optimize it -- or whether it's
even worth the bother.
-- Er*********@sun.com
On 5 Dec 2005 14:02:46 -0800, in comp.lang.c , "Kunal"
<ku*************@gmail.com> wrote: Hello,
I need help in removing if ..else conditions inside for loops.
Why - have you proved that they're inefficient?
c += (a > B) ;
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls.
This would be /highly/ hardware specific, and depend very very much on
your compiler's efficiency.
As a general rule its a bad idea to try to outsmart your compiler,
until and unless you can prove its inefficient. You may end up simply
making your code slower. A good compiler might realise it could unroll
the loop and discard a whole bunch of the ifs, and your 'improvement'
might prevent that for some reason.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Kunal wrote: Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped.
Have you tested the code to see if it is too slow? Have you done
profiling to see where the code is spending its time? Have you made sure
that you are using an efficient algorithm? All these things should come
before spending time on a question like this.
Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls.
Anything like that is highly specific to the processor, compiler,
specific version of the compiler, the settings of the compiler and the
surrounding code.
However, I havent found any document confirming my belief !
It is very unlikely there is *any* documentation that will tell you
which is faster, since it might depend on a hole host of things.
Any comments, suggestions or references will be a big help !
Rule one of optimisation:
Don't do it.
Write the code to do the right thing in an understandable (to a human)
manner and let the optimiser that is almost certainly part of your
compiler package do its job.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Kunal wrote: Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls.
On the ARM, a natural way to compile the if (assuming variables in
registers, which is plausible here) is:
CMP a, B
ADDEQ c, c, #1
Two instructions, no pipeline break. I can't see a compiler generating
better code for your `c += (a > B)` statement, and it would be easy for
it to generate much /worse/ code.
Morals: (a) measure before you consider optimising; (b) straightforward
code plays to the compiler's strengths.
--
Chris "another virtual machine" Dollin
"Certainly the absence of a smiley is not a syntax error or a constraint
violation, and therefore doesn't require a diagnostic." (Richard
Heathfield)
Hello,
Thanks for all your responses.
The example I had given is a typical (but not exact) one which I have
encountered during the development of the code.
I am working on development of video compression algorithm and have
encountered deep nested loops with embedded if ... else conditions,
typically like the one I have given in the example.
I have a stiff target to meet on fps (frame per second) front and hence
I am trying to remove such conditions where there may be pipeline
stalls. So optimization is inevitable.
I am still not clear why would the compiler generate a branch condition
if only a boolean expression is to be solved.
"Kunal" <ku*************@gmail.com> writes: I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
Because, given the machine's instruction set, that may be the
fastest or shortest way to evaluate the boolean expression. Many
machines provide "jump if <condition>" instructions, but not "set
0/1 based on <condition>" instructions.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Kunal wrote: Hello, Thanks for all your responses.
The example I had given is a typical (but not exact) one which I have encountered during the development of the code. I am working on development of video compression algorithm and have encountered deep nested loops with embedded if ... else conditions, typically like the one I have given in the example.
I have a stiff target to meet on fps (frame per second) front and hence I am trying to remove such conditions where there may be pipeline stalls. So optimization is inevitable.
I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
Because that's what computers do. Solving a boolean results in a
conditional branch (or jump or call, whatever).
C's if/else constructs are not expensive as a rule. Deeply nested loops,
poorly designed, can drag you to a stop. Algorithm failure.
As programmers we should concern ourselves with the algorithms which
solve our problems. It is a waste of our time, and rather arrogant of
most of us, to try to optimize lagnuage constructs like if, else, while,
etc. because the guys and girls who wrote the compiler know that stuff
better than we do. We design and code the algorithm. Leave code
optimization to the compiler.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Ben Pfaff wrote: "Kunal" <ku*************@gmail.com> writes:
I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
Because, given the machine's instruction set, that may be the fastest or shortest way to evaluate the boolean expression. Many machines provide "jump if <condition>" instructions, but not "set 0/1 based on <condition>" instructions.
And even those that do might have to allocate a new register to store the
evaluated result in, which could be costlier overall.
S.
"Kunal" <ku*************@gmail.com> writes: Thanks for all your responses.
To what? Please read <http://cfaj.freeshell.org/google/>.
[...]
I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
As in
c += (a > B);
as opposed to the equivalent
if (a > B)
c++;
}
If you're familiar with the assembly language of whatever CPU you
happen to be using, try writing your own code to implement the first
assignment. If the CPU provides an instruction that compares two
values and stores a 0 or 1 depending on the result, the compiler is
likely to use it. If not, a conditional branch may well be the best
way to accomplish it, even if it might cause a pipeline stall.
If the CPU has an instruction that could do the job efficiently and
it's not using it (when you specify the maximum level of
optimization), you might consider complaining to the compiler vendor.
It's really not a C language issue. As long as the generated code
gets the right answer, the C standard is happy.
Note that the results of equality and relational operators are
*usually* used as conditions rather than to produce an actual 0 or 1
value. Because of this, the authors of your compiler might reasonably
not have bothered spending much time on optimizing this kind of thing.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
In article <11**********************@f14g2000cwb.googlegroups .com>,
"Kunal" <ku*************@gmail.com> wrote: Hello, Thanks for all your responses.
The example I had given is a typical (but not exact) one which I have encountered during the development of the code. I am working on development of video compression algorithm and have encountered deep nested loops with embedded if ... else conditions, typically like the one I have given in the example.
I have a stiff target to meet on fps (frame per second) front and hence I am trying to remove such conditions where there may be pipeline stalls. So optimization is inevitable.
I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
Just curious: You do that just for entertainment or for the learning
experience, or is someone actually employing programmers who try to
learn about optimisation by posting on comp.lang.c to implement video
compression algorithms?
Kunal wrote: c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Could you remove the if from the loop:
loop( condition )
if( something )
stuff
else
other stuff
end loop
if( something )
loop (condition)
stuff
end loop
else
loop( condition )
stuff
end loop
endif
Joe Wright wrote: Kunal wrote:
Hello, Thanks for all your responses.
The example I had given is a typical (but not exact) one which I have encountered during the development of the code. I am working on development of video compression algorithm and have encountered deep nested loops with embedded if ... else conditions, typically like the one I have given in the example.
I have a stiff target to meet on fps (frame per second) front and hence I am trying to remove such conditions where there may be pipeline stalls. So optimization is inevitable.
I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved. Because that's what computers do. Solving a boolean results in a conditional branch (or jump or call, whatever).
C's if/else constructs are not expensive as a rule. Deeply nested loops, poorly designed, can drag you to a stop. Algorithm failure.
As programmers we should concern ourselves with the algorithms which solve our problems. It is a waste of our time, and rather arrogant of most of us, to try to optimize lagnuage constructs like if, else, while, etc. because the guys and girls who wrote the compiler know that stuff better than we do. We design and code the algorithm. Leave code optimization to the compiler.
Kunal did mention that he's subject to tight performance
requirements. If good algorithms have been chosen and the
unaided compiler still can't meet the performance specs, it
may well be time to micro-optimize.
Two important points, though: First, he MUST measure to
isolate the cause(s) of the failure to perform fast enough.
If the loop takes one percent of the total time and he gets
it to run ten thousand times faster than it does now, he'll
have made less than a one percent improvement in the program
as a whole. Second, the gains from micro-optimization are
usually rather modest: You can seldom expect to get dramatic
speedups from the kind of transformation Kunal is considering.
If Kunal's program is just a whisker too slow, fiddling with
the `if' has a chance of boosting the speed just enough --
but if the program is now running at only half the required
speed, this sort of thing is surpassingly unlikely to help.
Sure, counter-examples to the second point exist -- but the
big gains usually stem from things like arranging the data in
ways that are friendly to the machine's caches, issuing pre-
fetches for data that'll be needed several instructions further
along, and a lot of other such implementation-specific techniques
that really have no "image" in the C language as such. If such
shenanigans are needed, Kunal needs to consult people who are
experts on his system.
--
Eric Sosman es*****@acm-dot-org.invalid
In article <11**********************@f14g2000cwb.googlegroups .com>,
Kunal <ku*************@gmail.com> wrote: I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
As you know, "A > B" means "1 if A > B and 0 otherwise". It may well
be that to get the right one of those values - 1 or 0 - the quickest
way is to test and branch.
Of course, it may not be. Depending on the instruction set, there may
be a direct way to get 1 or 0 in a register according to the result of
the comparison. But if you can see a simple transformation of your
code that allows this, then very likely the compiler can too.
The only way is to try it and see, and remember that it won't
necessarily be better on other processors.
-- Richard
Keith Thompson wrote: "Kunal" <ku*************@gmail.com> writes: Thanks for all your responses.
To what? Please read <http://cfaj.freeshell.org/google/>.
[...]
I am still not clear why would the compiler generate a branch condition if only a boolean expression is to be solved.
As in c += (a > B); as opposed to the equivalent if (a > B) c++; }
If you're familiar with the assembly language of whatever CPU you happen to be using, try writing your own code to implement the first assignment. If the CPU provides an instruction that compares two values and stores a 0 or 1 depending on the result, the compiler is likely to use it. If not, a conditional branch may well be the best way to accomplish it, even if it might cause a pipeline stall.
If the CPU has an instruction that could do the job efficiently and it's not using it (when you specify the maximum level of optimization), you might consider complaining to the compiler vendor.
It's really not a C language issue. As long as the generated code gets the right answer, the C standard is happy.
Actually, does the C standard now require a true expression result to
be 1?
(sorry, but I still think of C in terms of the original K&R, where 0 is
false and anything else is true. And I've done enough assembler
programming to know the compare doesn't simply result in a 1 in a
usable register.)
Ed
On 2005-12-07, Ed Prochak <ed********@magicinterface.com> wrote: Keith Thompson wrote: "Kunal" <ku*************@gmail.com> writes: > Thanks for all your responses.
To what? Please read <http://cfaj.freeshell.org/google/>.
[...]
> I am still not clear why would the compiler generate a branch condition > if only a boolean expression is to be solved.
As in c += (a > B); as opposed to the equivalent if (a > B) c++; }
If you're familiar with the assembly language of whatever CPU you happen to be using, try writing your own code to implement the first assignment. If the CPU provides an instruction that compares two values and stores a 0 or 1 depending on the result, the compiler is likely to use it. If not, a conditional branch may well be the best way to accomplish it, even if it might cause a pipeline stall.
If the CPU has an instruction that could do the job efficiently and it's not using it (when you specify the maximum level of optimization), you might consider complaining to the compiler vendor.
It's really not a C language issue. As long as the generated code gets the right answer, the C standard is happy.
Actually, does the C standard now require a true expression result to be 1? (sorry, but I still think of C in terms of the original K&R, where 0 is false and anything else is true. And I've done enough assembler programming to know the compare doesn't simply result in a 1 in a usable register.)
the "as if" rule will let you weasel out of it in most cases for a real
implementation, but if you assign the result of a relational/equality
comparison expression to an integer variable, it must be 1 for true, 0
for false.
"Ed Prochak" <ed********@magicinterface.com> writes: Keith Thompson wrote: "Kunal" <ku*************@gmail.com> writes: > Thanks for all your responses. To what? Please read <http://cfaj.freeshell.org/google/>.
[...]
> I am still not clear why would the compiler generate a branch condition > if only a boolean expression is to be solved.
As in c += (a > B); as opposed to the equivalent if (a > B) c++; }
If you're familiar with the assembly language of whatever CPU you happen to be using, try writing your own code to implement the first assignment. If the CPU provides an instruction that compares two values and stores a 0 or 1 depending on the result, the compiler is likely to use it. If not, a conditional branch may well be the best way to accomplish it, even if it might cause a pipeline stall.
If the CPU has an instruction that could do the job efficiently and it's not using it (when you specify the maximum level of optimization), you might consider complaining to the compiler vendor.
It's really not a C language issue. As long as the generated code gets the right answer, the C standard is happy.
Actually, does the C standard now require a true expression result to be 1?
It depends on the expression.
The result of any operator that yields a boolean result is required to
be 0 for false, 1 for true; this applies to relational operators,
equality operators, unary "!", and probably others I haven't thought
of. The statement
c += (a > B);
is guaranteed to add either 0 or 1 to c; if it adds 2, the compiler is
broken (or you've invoked undefined behavior somewhere).
The is*() functions in <ctype.h> may return any non-zero value if the
corresponding condition is true. The statement
c += isdigit(x);
is unlikely to do what you want it to. If you specifically want to
add 0 or 1, you can do
c += !!isdigit(x);
or any of a number of other workarounds.
If an expression is used as a condition, it's treated as false if it
compares equal to 0, true otherwise.
(sorry, but I still think of C in terms of the original K&R, where 0 is false and anything else is true.
That hasn't changed -- nor has the fact that *some* boolean
expressions are guaranteed to evaluate to either 0 or 1. (I *think*
K&R1 guaranteed this, but I don't have my copy here.)
And I've done enough assembler programming to know the compare doesn't simply result in a 1 in a usable register.)
That depends on the CPU. If a comparison doesn't result in a 0 or 1
in a usable register, the compiler will have to go to some extra
effort to generate the 0 or 1 value, unless it can legally optimize
out the result. For example, given
if (x == y) { ... } else { ... }
the expression "x == y" yields a value of 0 or 1, but the generated
code doesn't have to store this value anywhere as long as executes the
correct block of code.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Kunal wrote: Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
For most compilers the two are exactly the same.
But a more importantly real savings come from doing more serious
optimizations like this:
if (a > B) {
for (i=0; i < 999; i++) c++;
}
which is equivalent to:
c += 999 * (a > B);
Of course if your compiler is good enough, it can figure all this out
as well.
Seriously though, if you want to remove branched from the inside of a
loop, hoisting is usually the best way, when it is available. If a
and/or B is really a macro that makes it a function of i, or itself, or
something like that, then it will depend on how they expand out.
Unfortunately the ANSI C standard is basically broken on the right
shift operator, but on most compilers, if you know a and B are signed
ints and positive you have certain functional tricks like:
(a > B)
is the same as:
- ((B - a) >> (sizeof (int) * CHAR_BIT - 1))
which does remove the branch pretty much for sure. But as I said, the
ANSI C standard doesn't allow you to assume that the two are same when
a and B are positive (they are on > 99.999% of compilers deployed.)
--
Paul Hsieh http://www.pobox.com/~qed/ http://bstring.sf.net/
like I said in my earlier post, the if conditions are embedded deep
inside multiple for loops. Hence such an opportunity has rarely
occurred .... and whenever it has, this technique has been used.
Elementary optimizations like this should be left to compiler only and
should not be done at the cost of code clarity and readability.
Moreover original code seems to be more optimized than the modified
code if compiler optimization is kept aside. Original code increments
only if condition is satisfied while modified code does both operations
(checking condition and doing addition) and always. One more
optimization can be done by doing a pre-increment both inside for loop
as well as inside the block if post increment is not really required.
thanks
--naren
Kunal wrote: Hello,
I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I have used. Original code :
c= 0 ; for (i=0; i<999; i++) { if (a > B) c++ ; }
Modified code for speed optimization
c= 0 ; for (i=0; i<999; i++) { c += (a > B) ; }
As per my reasoning, the logical expression is evaluated but no conditional branching instructions should be generated. This should avoid any pipeline stalls. However, I havent found any document confirming my belief ! Any comments, suggestions or references will be a big help !
Thanks & Regards This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: PWalker |
last post by:
Hi, I have written code that I would like to optimize. I need to push it to
the limit interms of speed as the accuracy of results are proportional to
runtime.
First off, would anyone know any...
|
by: Hagen |
last post by:
Hi,
I have a question that you probably shouldn´t worry about since the
compiler cares for it, but anyways:
When you run your compiler with optimization turned on (eg. g++ with -Ox
flag) and...
|
by: WantedToBeDBA |
last post by:
Hi all,
db2 => create table emp(empno int not null primary key, \
db2 (cont.) => sex char(1) not null constraint s_check check \
db2 (cont.) => (sex in ('m','f')) \
db2 (cont.) => not enforced...
|
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...
|
by: junky_fellow |
last post by:
What are the basic guidelines to write an optimised code.
What points should one keep in mind for this ?
Is this purely architecture or complier specific ?
Are there any general techniques that...
|
by: cyberscout |
last post by:
OK I have some code which I didn't write and I'm toying with whether I
need to tidy it up.
In the code is the line shown in Example 1
Exampe 1:
sprintf(stringvariable, "%s", "String");
...
|
by: Mike |
last post by:
Is it still true that the managed C++ compiler will produce much better
opimizations than the C# compiler, or have some of the more
global/aggressive opimizations been rolled into the 2005...
|
by: Peter Olcott |
last post by:
Cab you write code directly in the Common Intermediate language? I need to
optimize a critical real-time function.
|
by: galiorenye |
last post by:
Hi,
Given this code:
A** ppA = new A*;
A *pA = NULL;
for(int i = 0; i < 10; ++i)
{
pA = ppA;
//do something with pA
|
by: somenath |
last post by:
Hi All,
I was going through one of the exercise of one C tutorial .
In that they have given one small code and asked about the output.
#include <stdio.h>
int main(void)
{
int x =...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |