Zero Optimization and Sign Optimization???

Discussion in 'C Programming' started by Ravikiran, Nov 17, 2008.

  1. Ravikiran

    Ravikiran Guest

    Hi Friends,

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


    Thank you...
    Ravikiran, Nov 17, 2008
    #1
    1. Advertising

  2. On 17 Nov, 08:42, Ravikiran <> wrote:

    >          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.

    --
    Nick Keighley
    Nick Keighley, Nov 17, 2008
    #2
    1. Advertising

  3. Ravikiran

    CBFalconer Guest

    "christian.bau" wrote:
    > Ravikiran <> wrote:
    >
    >> I wanted know about whatt is ment by zero optimization and sign
    >> optimization and its differences....

    >
    > 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.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Nov 17, 2008
    #3
  4. Ravikiran

    jameskuyper Guest

    CBFalconer wrote:
    > "christian.bau" wrote:
    > > Ravikiran <> wrote:

    ....
    > > 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.


    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.
    jameskuyper, Nov 17, 2008
    #4
  5. Ravikiran <> writes:
    > 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.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Nov 18, 2008
    #5
  6. Ravikiran

    Phil Carmody Guest

    Keith Thompson <> writes:
    > Ravikiran <> writes:
    >> 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.


    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
    --
    I tried the Vista speech recognition by running the tutorial. I was
    amazed, it was awesome, recognised every word I said. Then I said the
    wrong word ... and it typed the right one. It was actually just
    detecting a sound and printing the expected word! -- pbhj on /.
    Phil Carmody, Nov 18, 2008
    #6
  7. On 17 Nov, 22:07, jameskuyper <> wrote:
    > CBFalconer wrote:
    > > "christian.bau" wrote:
    > > > Ravikiran <> wrote:

    > ...
    > > > 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.

    >
    > 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
    > 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.- Hide quoted text -
    >
    > - Show quoted text -
    Nick Keighley, Nov 18, 2008
    #7
  8. Ravikiran

    James Kuyper Guest

    Nick Keighley wrote:
    > On 17 Nov, 22:07, jameskuyper <> wrote:
    >> CBFalconer wrote:
    >>> "christian.bau" wrote:
    >>>> Ravikiran <> wrote:

    >> ...
    >>>> 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.

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

    >
    > 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".
    James Kuyper, Nov 18, 2008
    #8
  9. On 18 Nov, 11:57, James Kuyper <> wrote:
    > Nick Keighley wrote:
    > > On 17 Nov, 22:07, jameskuyper <> wrote:
    > >> CBFalconer wrote:
    > >>> "christian.bau" wrote:
    > >>>> Ravikiran <> wrote:



    > >>>> 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.

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

    >
    > > I thought he was taking the micky

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


    I toyed with "taking the piss".
    "taking the micky" is a UKism

    > 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


    --
    Nick Keighley
    Nick Keighley, Nov 18, 2008
    #9
  10. Ravikiran

    CBFalconer Guest

    "christian.bau" wrote:
    > CBFalconer <> wrote:
    >> "christian.bau" wrote:
    >>> Ravikiran <> wrote:
    >>>
    >>>> I wanted know about whatt is ment by zero optimization and sign
    >>>> optimization and its differences....
    >>>
    >>> 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.

    >
    > 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.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Nov 19, 2008
    #10
  11. Ravikiran

    James Kuyper Guest

    CBFalconer wrote:
    > "christian.bau" wrote:

    ....
    >> 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.


    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?
    James Kuyper, Nov 19, 2008
    #11
  12. Ravikiran

    CBFalconer Guest

    James Kuyper wrote:
    > CBFalconer wrote:
    >> "christian.bau" wrote:

    > ...
    >>> 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.

    >
    > 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.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Nov 19, 2008
    #12
  13. Ravikiran

    James Kuyper Guest

    Gordon Burditt wrote:
    > In article <>,
    > CBFalconer <> wrote:
    >> James Kuyper wrote:
    >>> CBFalconer wrote:
    >>>> "christian.bau" 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.
    James Kuyper, Nov 19, 2008
    #13
  14. Ravikiran

    Phil Carmody Guest

    CBFalconer <> writes:
    > 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
    --
    I tried the Vista speech recognition by running the tutorial. I was
    amazed, it was awesome, recognised every word I said. Then I said the
    wrong word ... and it typed the right one. It was actually just
    detecting a sound and printing the expected word! -- pbhj on /.
    Phil Carmody, Nov 19, 2008
    #14
  15. (Gordon Burditt) writes:
    > In article <>,
    > CBFalconer <> wrote:
    >>James Kuyper wrote:
    >>> CBFalconer wrote:
    >>>> "christian.bau" 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.

    [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.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Nov 19, 2008
    #15
  16. James Kuyper <> writes:
    > 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).

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Nov 19, 2008
    #16
  17. Ravikiran

    CBFalconer Guest

    Gordon Burditt wrote:
    > CBFalconer <> wrote:
    >> James Kuyper wrote:
    >>> CBFalconer wrote:
    >>>> "christian.bau" 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.


    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/>

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Nov 20, 2008
    #17
  18. Ravikiran

    Thad Smith Guest

    Phil Carmody wrote:
    > CBFalconer <> writes:
    >> 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.


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

    --
    Thad
    Thad Smith, Nov 23, 2008
    #18
  19. Ravikiran

    Thad Smith Guest

    James Kuyper wrote:
    > Nick Keighley wrote:
    >> On 17 Nov, 22:07, jameskuyper <> wrote:
    >>> CBFalconer wrote:
    >>>> "christian.bau" wrote:
    >>>>> Ravikiran <> wrote:
    >>> ...
    >>>>> 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.

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

    >>
    >> 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.


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

    --
    Thad
    Thad Smith, Nov 23, 2008
    #19
  20. Ravikiran

    Thad Smith Guest

    Keith Thompson wrote:

    > 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.

    --
    Thad
    Thad Smith, Nov 23, 2008
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zhiqiang Ye
    Replies:
    53
    Views:
    10,220
    Dan Pop
    Jun 28, 2004
  2. Gerard Flanagan
    Replies:
    3
    Views:
    432
    Terry Hancock
    Nov 19, 2005
  3. Jimmy
    Replies:
    1
    Views:
    919
    Cowboy \(Gregory A. Beamer\)
    Nov 21, 2006
  4. Christopher Benson-Manica

    Doubles and zero/negative zero

    Christopher Benson-Manica, Jun 30, 2004, in forum: C Programming
    Replies:
    4
    Views:
    659
    Walter
    Jul 1, 2004
  5. Jimmy
    Replies:
    3
    Views:
    2,381
    shimmyshack
    Nov 20, 2006
Loading...

Share This Page