Re: Thinking assembly?
From: Randall Hyde (randyhyde_at_earthlink.net)
Date: 01/20/04
- Next message: Randall Hyde: "Re: Thinking assembly?"
- Previous message: Thomas L. Christensen: "Re: Thinking assembly?"
- In reply to: Beth: "Re: Thinking assembly?"
- Next in thread: Beth: "Re: Thinking assembly?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Jan 2004 16:45:30 GMT
"Beth" <BethStone21@hotmail.NOSPICEDHAM.com> wrote in message
news:5G4Pb.25$9b5.0@newsfep3-gui.server.ntli.net...
>
> > Replacing it by an O(n) algorithm in a HLL will give
> > better results than simply reducing the constant factor with
> > assembly.
>
> Without a shadow of a doubt; But, as I mention, replacing it with an
> "O(n)" algorithm in ASM will give even better results again...because
> we can improve _BOTH_ the algorithm _AND_ reduce that constant factor
> as well...
Actually, as someone who actually paid attention in an algorithms
analysis class will tell you (:-)), replacing an O(n**2) algorithm by
an O(n) algorithm may *not* give better results. "n" has to be
sufficiently large and the corresponding constants (hidden by the
Big-Oh notation) need to be reasonable.
One other thing, in Big-Oh notation, any O(n) algorithm is
automatically O(n**2), so when you replace that O(n**2)
algorithm by an O(n) algorithm, it must be the case that the
lower bounds on the original algorithm was really quadratic
in nature (yeah, that's a nit-pick, but as long as we're splitting
hairs here).
The truth is, the "better algorithms prove assembly isn't useful"
argument is almost always a red herring. If someone is capable
of finding that lower-term algorithm in a HLL, they're equally
capable of it in assembly. The truth is, if someone is using a
bad algorithm, then chances are pretty good they're going to
use that same bad algorithm no matter what language they
choose. The argument that "I don't have to even consider
assembly because all I've got to do is find a better algorithm"
evades the fact that there might not *be* a better algorithm
(in the sense that you can reduce the polynomial/whatever
associated with the algorithm).
Another problem with the "Big-Oh proof that assembly
isn't useful" is the fact that Big-Oh notation completely ignores
the constant. I don't know about the rest of the world, but
a 10x performance improvement is pretty significant to me.
This, in fact, often allows the use of a poorer, but easier to
understand and maintain, algorithm rather than a better, but
complex and difficult to maintain algorithm.
Cheers,
Randy Hyde
- Next message: Randall Hyde: "Re: Thinking assembly?"
- Previous message: Thomas L. Christensen: "Re: Thinking assembly?"
- In reply to: Beth: "Re: Thinking assembly?"
- Next in thread: Beth: "Re: Thinking assembly?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|