R
Rui Maciel
BartC said:So what? If this is a product to be sold/used in thousands and millions,
you'll probably find that a small number of platforms will dominate. Then
it's worth producing a custom version for the top one or two. The rest can
use the slow version.
I don't believe that the idea of replacing C with assembly, in this context,
meant that the assembly instructions represented specialized routines for a
specific platform. In this context, replacing C with assembly meant
replacing C with assembly, in the sense that the routine consisted of a
single specialized piece of code which could only run on a very specific
platform and that there wasn't any alternative to it.
You're assuming this is for a one-off program that will only be run once.
Then you could well spend more time programming than will be saved in
runtime. But usually that is not the case.
Not necessarily. Nowadays compilers do churn out optimized code, and
chances are they do a far better job at it than any random programmer. This
means that, just by tweaking a single compiler flag, we may get all the
optimizations which any random programmer might be able to use, without
wasting days rewriting stuff and while avoiding to increase the complexity
of our project. And there's of course the risk of potentially introducing
new non-trivial bugs which aren't easily catched, even with a debugger.
Rui Maciel