memset suggestion.

Rick Jones rick_jones2 at hp.com
Sat Nov 9 07:20:15 EST 2002


> > Which is why the optimization is not "bad" but perhaps "unfortunate"
> > instead. Within the context of the output of the program, optimizing
> > the memset away is fine.
> >
> 
> Don't know.. I guess I expect too much from compilers.  I expect:
> 
> 1. Code I write stays written.  if I put a memset() in.. I put it in for a
> damn good reason.=)  I hate when computers second guess me.

I guess that precludes a compiler ever trying to do dead code
elimination :)

It also goes against the decades long trend of trying to make
"programming" something that can be done by a room full of briefly
trained primates.

I suspect that the only sure way to have code one writes stay written is
to write in assembly :)

> 2. I expect the compiler to produce reasonable and predictable
> optimization.  GCC fails at both of these at higher optimizations.
> 
> 3. If a compiler decides to yank stuff I wrote out.. I expect it to tell
> me.  "warning: xxx() removed as dead code"

Of course, if it did that by default, the other 99.99% of the
programmers out there would start to complain about too many messages
comeing from the compiler.

> that way I at least know what the compiler is removing of my code so I can
> either report it as a bug/misfeature or correct my code so it does not
> remove it.
> 
> Maybe I am asking too much.=)

Entirely possible :)

> if your still having 'preformance' issues at -O2.  I'd seriously look at
> why.  Most fall into:


> 1. Lack of OS support of critical features (Ala /dev/random)
> 2. Lack of clean well written (programmer optimized) critical functions
> 3. Lack of processor support for critical features (Ala D/H key
>    generation on SS20)
> 4. Bad/overcomplex design
> 5. Not enough ram, too slow of processor, bad hardware design, etc.

I was thinking more "in general" than ssh specific, but yes, those are
all good points. I think it would be goodness for PBO to become more
widely used - it allows the compiler to know more about how your program
will run and so it can make more informed deicisons about branches and
all that sort of stuff...

> The last thing you want is to crank up -O.  Entrusting your code to a
> random compiler is asking for trouble.

I must be a very troubled soul :)

rick jones
-- 
Wisdom Teeth are impacted, people are affected by the effects of events.
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to raj in cup.hp.com  but NOT BOTH...



More information about the openssh-unix-dev mailing list