On (24 Apr 97) Herman Schonfeld wrote to Carey Bloodworth...
CB>Let's work through a simple project. Let's say that we need to
CB>copy some data from one array to another. Basically, just like
CB>memcpy()
HS> I don't need to be tutured!
Your messages indicate a need for tutoring in both programming and
spelling.
CB>void memcpy(char to[], char from[], int len)
CB>{ while (len--) to[len]=from[len];}
HS> Sloppy code!
HS> And you claim that optimization creates sloppy code.
I not only claim, but have _proven_ that what you claimed was
optimization produced extremely sloppy code that was considerably larger
and slower than the readable code you started with.
HS> First off all, try unrolling the loop, and use pointer refferencing.
And be prepared for the code to be slower after you do so. If you have
a compiler that can't unroll loops on its own, throw it away a get a
decent one instead. My guess is that the only compilers around that
wont' do this on their own are stripped down versions with all or most
optimizations intentionally removed.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|