Related articles |
---|
[48 earlier articles] |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? schwarz@mips.complang.tuwien.ac.at (1996-03-25) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? pardo@cs.washington.edu (1996-03-25) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? mgrice@iastate.edu (1996-03-27) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? sberg@camtronics.com (1996-03-31) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? nather@astro.as.utexas.edu (R. Edward Nather) (1996-04-02) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? ok@cs.rmit.edu.au (1996-04-02) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? sberg@camtronics.com (1996-04-06) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? ok@cs.rmit.edu.au (1996-04-10) |
From: | sberg@camtronics.com (Scott A. Berg) |
Newsgroups: | comp.arch,comp.compilers |
Date: | 6 Apr 1996 22:12:43 -0500 |
Organization: | Alpha.net -- Milwaukee, WI |
References: | 96-03-006 96-03-139 96-03-218 96-04-019 |
Keywords: | optimize |
sberg@camtronics.com (Scott A. Berg) writes:
>Well in general I agree, but no one seems to have covered the all too
>common dead end. Suppose you want to sort a list of a few hundred
>seemingly random integers (no special properties to exploit like being
>generated in almost sorted order) and you are already using quicksort
>(or some other O(n log n) algorithm) and it's still too slow. There
>ARE no faster algorithms and diddling with the code to squeeze a few
>constants can make the difference.
ok@cs.rmit.edu.au says...
>Wrong. Being integers is a special property, and there ARE faster
>algorithms, including radix sort (for *fixed* integer sizes it is O(N)
>and the cross-over point for when it's better than quicksort is
>typically about 100) and bucket sort (which is O(N) average time and
>O(NlgN) worst case, and quite easy to program).
So these are 32 or even 64 bit integers or even floating point
numbers, randomly and uniformly spread across the entire range. How
many buckets is this? Or perhaps you're using different names for
sorts than I'm used to seeing.
>If I were in that kind of dead end, I'd turn around and say "hmm,
>where did these integers come from? Can I change the code that
>_generates_ them?"
I agree. Too many times the "easy" solution takes months to find
because no one questioned the basics. Then again, sometimes you're
stuck with tough problems (that's what NP-complete is all about...).
>>Besides, I've rarely run into the need for such a distinct function as
>>a list sort or a string search or some other "classroom example"
>>algorithm, and deriving minimal big-oh algorithms is rarely a pastime
>>in industry.
>I have seen "industrial" code using an O(N**3) algorithm when an
>O(N.lgN) algorithm is known. I have seen "industrial" code failing to
>take advantage of 'modern' data structures like splay trees or skip
>lists when they could have been used.
Alas, so have I. Perhaps we should spend less time attempting to
create the ultimate compiler and more time teaching practitioners how
to use what they've got! Besides, if you see these sort of problems
with the applications, why do you think the compilers are any better?
--
Scott A. Berg
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.