|
![](/i/fill.gif) |
scott wrote:
> Well it really depends on how *difficult* it is to match or beat any
> language with assembler. It's always theoretically possible, but as you
> say with modern CPU and compiler design it is becoming increasingly harder.
That was exactly my point. You can always disassemble the output of the C
compiler to get assembler code, so C cannot by definition beat assembler.
Nor can anything else.
It's merely a question of how much you're willing to pay to scrape out those
last few cycles, and whether you really need those last few cycles. But the
same applies to anything else. Could you take Bellcore's database systems
with hundreds of millions of lines of SQL stored procedures and rewrite it
entirely in C? Certainly. Is it worthwhile doing it that way to speed it up?
Of course not.
So saying that one language is faster than a completely different language
is one of those FUD overgeneralizations. It's true in some cases, and not in
others. How fast is C at building and analyzing parse trees that are too big
to fit in memory? You're probably better off abstracting the problem, either
with a library or a programming language, and the programming language will
be able to make better global choices than any straightforward library.
I suspect most people using C and C++ and such don't really ever profile
parts of their applications they didn't write. They don't look for speedups
in the runtime libraries, or Boost, or pthreads, or whatever else they're
using. Just like there are few people who actually compare the speed of
garbage collection against the speed of manual memory management in real
programs, and just assume that if the programmer's managing it, it must be
faster. But it isn't always, exactly because the GC engine can do the kind
of global analysis that the C compiler does for things like register
allocation.
Of course the holy grail is a programming language that *is* high level and
easy to use while also being capable of being turned into extremely
efficient machine code.
--
Darren New, San Diego CA, USA (PST)
"Ouch ouch ouch!"
"What's wrong? Noodles too hot?"
"No, I have Chopstick Tunnel Syndrome."
Post a reply to this message
|
![](/i/fill.gif) |