Zero Optimization and Sign Optimization???

R

Ravikiran

Hi Friends,

I wanted know about whatt is ment by zero optimization and
sign optimization and its differences....


Thank you...
 
N

Nick Keighley

         I wanted know about whatt is ment by zero optimization and
sign optimization and its differences....

optimisation techniques are not on-topic for comp.lang.c.
Try comp.programming or a compiler group or just google it.
 
C

CBFalconer

christian.bau said:
Whenever my company outsources programming jobs they specify in
the contract how much optimisation is required. "Zero
optimisation" means code that works, without being optimised. If
we want optimisations, then someone in management has to sign
because of the additional cost, so there is always a space left
in the contract marked "Sign optimisation" where someone can sign
to require optimisation.

The differences between "sign optimisation" and "zero
optimisation" can be many thousands in cost, plus delays in
development of weeks, or even months.

Nonsense. If the compiler is accurate, and the code does not take
liberties with the standard, the only effect of optimization is to
speed up or compress (or both) the output code. However it may
reduce the ability to debug the final program.
 
J

jameskuyper

CBFalconer said:
Nonsense. If the compiler is accurate, and the code does not take
liberties with the standard, the only effect of optimization is to
speed up or compress (or both) the output code. However it may
reduce the ability to debug the final program.

Most real code takes some liberties with the standard, and most
compilers have some optimization options that render them slightly non-
conforming. Uncovering the "liberties" takes time and effort to fix.
Determining whether or not code modifications are required to take
advantage of non-conforming optimization options, and deciding whether
or not the optimization is worth the trouble, can take a lot of time.
Distinguishing between problems due to bad code and problems due to
dangerous optimizations also takes time.

However, I strongly suspect that Christian was not talking merely
about compiler optimization levels. I suspect he was also (perhaps
even mainly) talking about optimizations that require re-writing the
code. That requires taking the time to profile a program, determine
where it's wasting a lot of time, and then hand-optimizing those
particular sections. This will often involve a trade-off between
clarity, maintainability, cost, and efficiency. The sign-off would be
required to certify that management is willing to accept that this
trade-off is worth making. This is often denigrated as "micro-
optimization", and is (on rare occasions) absolutely necessary to meet
a performance requirement.
 
K

Keith Thompson

Ravikiran said:
I wanted know about whatt is ment by zero optimization and
sign optimization and its differences....

Those aren't C language concepts, and I've never heard of them.

I just did a Google search for both terms; the only hits were for you
asking the question.

If you can tell us where you ran across these terms, we might be able
to give you an idea of a better place to ask about them, but I suspect
you've simply misunderstood something.
 
P

Phil Carmody

Keith Thompson said:
Those aren't C language concepts, and I've never heard of them.

The only pair of /\b(sign|zero) \w+ion\b/ matches I can
think of is sign extension and zero extension, such as
in the x86 opcodes movsx and movzx.

But that ain't nuthin' to do with C.

Phil
 
N

Nick Keighley

Most real code takes some liberties with the standard, and most
compilers have some optimization options that render them slightly non-
conforming. Uncovering the "liberties" takes time and effort to fix.
Determining whether or not code modifications are required to take
advantage of non-conforming optimization options, and deciding whether
or not the optimization is worth the trouble, can take a lot of time.
Distinguishing between problems due to bad code and problems due to
dangerous optimizations also takes time.

However, I strongly suspect that Christian was not talking merely
about compiler optimization levels.

I thought he was taking the micky


I suspect he was also (perhaps
 
J

James Kuyper

Nick said:
I thought he was taking the micky

I had to look that phrase up - I've never heard it before.

I doubt it - it looked like a perfectly serious response to. I've never
heard of "sign optimization", but Christian's answer provides a
plausible explanation of why someone might run into the words "sign" and
"optimization" juxtaposed in such a way that they could misinterpret
them as referring to something called "sign optimization".
 
C

CBFalconer

christian.bau said:
My dear CBFalconer, please explain to me what the compiler has to do
with this. I am talking about source code; I am not even mentioning a
programming language or that a compiler would be used.

Because if the compiler is inaccurate there is no guarantee that
the optimization step is accurate. Nobody in their right mind
optimizes by diddling source code.
 
J

James Kuyper

CBFalconer said:
: ....

Because if the compiler is inaccurate there is no guarantee that
the optimization step is accurate. Nobody in their right mind
optimizes by diddling source code.

How do you justify that assertion? Are you seriously suggesting that
profiling a program to identify it's choke points, and looking for ways
to speed up those parts of the program, is seldom if ever cost-effective?
 
C

CBFalconer

James said:
How do you justify that assertion? Are you seriously suggesting
that profiling a program to identify it's choke points, and
looking for ways to speed up those parts of the program, is
seldom if ever cost-effective?

Alright, I was sloppy. I was thinking of the sort of optimization
a compiler does, not algorithm improvement or replacement.
 
J

James Kuyper

Gordon said:
What is "no optimization"? Ok, most compilers have their own way
of not requesting optimization (except arguably for those that don't
offer any optimization to not request - I don't know of any but
there probably are some), but there's no standard for that and one
compiler's idea of "no optimization" might be quite optimized
compared with that of another compiler.

Has anyone used the phrase "no optimization"? If so, you should have
quoted the text where that phrase was used.

The phrase "Zero Optimization" is in the subject line of this message,
and Christian has used the phrase "code that works, without being
optimised". I think there has been some confusion about whether the
discussion is about optimization of the source code performed by the
developer, or optimization of the executable code performed by the
compiler+linker. However, I think we have all been referring to the same
basic idea: code where no special effort has been exerted to optimize
it. In the case of the source code, highly experienced programmers
write, without exerting any special effort, source code that is heavily
optimized compared to that produced by newbies. Similarly, compilers
differ greatly in how optimized their code is at the lowest optimization
level. So "Zero optimization" does not refer to a clearly defined level
of optimization, just to a clearly defined level of effort expended.
 
P

Phil Carmody

CBFalconer said:
Because if the compiler is inaccurate there is no guarantee that
the optimization step is accurate. Nobody in their right mind
optimizes by diddling source code.

I practically only optimize by diddling the source code.

Phil
 
K

Keith Thompson

What is "no optimization"? Ok, most compilers have their own way
of not requesting optimization (except arguably for those that don't
offer any optimization to not request - I don't know of any but
there probably are some), but there's no standard for that and one
compiler's idea of "no optimization" might be quite optimized
compared with that of another compiler.
[snip]

Gordon, I think this is the first time I've seen a followup from you
that actually includes attribution lines. (You didn't actually quote
anything that any of the cited posters wrote, but hey, it's a start.)

If you've changed your mind about attribution lines, I'm delighted.
Really. If it was a mistake, I suggest you sit back and watch while
Nothing Bad Happens.
 
K

Keith Thompson

James Kuyper said:
Gordon Burditt wrote: [...]
What is "no optimization"? Ok, most compilers have their own way
of not requesting optimization (except arguably for those that don't
offer any optimization to not request - I don't know of any but
there probably are some), but there's no standard for that and one
compiler's idea of "no optimization" might be quite optimized
compared with that of another compiler.

Has anyone used the phrase "no optimization"? If so, you should have
quoted the text where that phrase was used.

The phrase "Zero Optimization" is in the subject line of this message,
and Christian has used the phrase "code that works, without being
optimised". I think there has been some confusion about whether the
discussion is about optimization of the source code performed by the
developer, or optimization of the executable code performed by the
compiler+linker. However, I think we have all been referring to the
same basic idea: code where no special effort has been exerted to
optimize it. In the case of the source code, highly experienced
programmers write, without exerting any special effort, source code
that is heavily optimized compared to that produced by
newbies. Similarly, compilers differ greatly in how optimized their
code is at the lowest optimization level. So "Zero optimization" does
not refer to a clearly defined level of optimization, just to a
clearly defined level of effort expended.

I don't think that "zero optimization" refers to anything.

The question that started this thread was:

I wanted know about whatt is ment by zero optimization and sign
optimization and its differences....

The OP was someone named Ravikiran.

My first thought was that the terms referred to some sort of
optimization of artithmetic operations having to do with special
treatment of zero values and/or of the sign bit. But as I mentioned
fairly early in the thread, a Google search for both terms got only a
few hits, all of which were the original poster asking this question.

Since the OP hasn't bothered to reply to any of the followups asking
him just what he's talking about, apparently this isn't very important
to him, and I suggest that we're wasting our time trying to come up
with a meaningful answer. Of course, sometimes meaningless questions
can lead to meaningful discussions (but, personally, I don't see that
happening in this case).
 
C

CBFalconer

Gordon said:
What is "no optimization"? Ok, most compilers have their own
way of not requesting optimization (except arguably for those
that don't offer any optimization to not request - I don't know
of any but there probably are some), but there's no standard
for that and one compiler's idea of "no optimization" might be
quite optimized compared with that of another compiler.

I suggest you replace 'trn'. It is apparantly incapable of
producing messages with proper quotations and snippages. This
makes your messages totally incomprehensible.

This is not applicable, but may be of some help. If you want to
post a followup via groups.google.com, ensure you quote enough for
the article to make sense. Google is only an interface to Usenet;
it's not Usenet itself. Don't assume your readers can, or ever
will, see any previous articles.

More details at: <http://cfaj.freeshell.org/google/>
 
T

Thad Smith

Phil said:
I practically only optimize by diddling the source code.

Ditto. Understanding your requirements and knowing the target helps you
know how to diddle.
 
T

Thad Smith

James said:
I had to look that phrase up - I've never heard it before.

I doubt it - it looked like a perfectly serious response to.

He must have pulled more legs than I realized. I thought it was clever.
 
T

Thad Smith

Keith said:
My first thought was that the terms referred to some sort of
optimization of artithmetic operations having to do with special
treatment of zero values and/or of the sign bit.

On some processor/compiler targets the loop
for (i=10; i; i--)
is more efficient than
for (i=0; i < 10, i++)

because of a decrement and branch non-zero or decrement and skip zero
instruction. That would be an optimization taking advantage of the
hardwired test for zero.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top