|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis <nam### [at] gmailcom> wrote:
> Nothing is faster than C, some wise men said. ;)
Someone claimed to me once that fortran has some tricks in its sleeve with
certain types of mathematical programming that allows it to generate much
faster code than C can. In order to get the same speed with C you have to
resort to (obviously non-portable) inline asm.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> nemesis <nam### [at] gmailcom> wrote:
>> Nothing is faster than C, some wise men said. ;)
>
> Someone claimed to me once that fortran has some tricks in its sleeve with
> certain types of mathematical programming that allows it to generate much
> faster code than C can. In order to get the same speed with C you have to
> resort to (obviously non-portable) inline asm.
I can't comment on whether that's true, but I know there is a fairly
large codebase of existing numerical-processing stuff in Fortran...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Darren New wrote:
> So saying that one language is faster than a completely different
> language is one of those FUD overgeneralizations.
Oh, and as another example, COBOL. It's much faster to do stuff like decimal
math and print formatting in COBOL (where it's built in) than C, especially
if your processor has instructions for it.
Plus, many processors these days are built for C and are hard to change.
Back when people were loading microcode themselves, machines running LISP or
Smalltalk were quite fast compared to those machines running C with the same
instruction set. It's more like "modern instruction sets favor C-like
languages" than anything else.
Stuff like dynamic dispatch in objects could be individual CISC instructions
and greatly speed things up, for example.
I'm also not sure if some of the Java hardware dosn't run Java faster than
it would run C.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Someone claimed to me once that fortran has some tricks in its sleeve with
> certain types of mathematical programming that allows it to generate much
> faster code than C can.
There's two tricks Fortran has...
1) It's OK to do single-precision math on two single-precision values.
2) It's not OK (simplified) to alias two values together and use them in the
same expression, so the compiler can assume less aliasing and keep more
stuff in registers over assignments. That makes it much easier to have a
loop doing B[I] = C[I] + A[I] and vectorize it, knowing B != A != C.
I think the later C standards improved (or tried to) on both these fields.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 17 Feb 2009 09:09:00 +0000, Invisible wrote:
>>> On the other hand, it seems that almost every forum I visit, I end up
>>> rubbing somebody up the wrong way.
>>
>> Welcome to the real world, Andrew. You're not going to rub everyone
>> the right way all the time.
>>
>>> I see two possibilities:
>>>
>>> - Everybody else on the Internet is an asshole.
>>>
>>> - I'm an asshole.
>>
>> There's a third possibility: Some of the people in the world (and on
>> the 'net) are assholes, and you run into them from time to time.
>>
>> Again, welcome to the real world. There are assholes out there. Best
>> way of dealing with them is to ignore them.
>
> That still doesn't explain why I'm the only one having this problem.
You aren't the only one in the entire world having this problem.
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 17 Feb 2009 07:31:08 -0600, Mike Raiford wrote:
> Jim Henderson wrote:
>
>> That's a good question, Slime. I've been wondering that myself.
>
> I agree.
>
> But, I find it ironic that one of his admonishments was not to derail
> the thread, only to see there is a large part of this thread that has
> absolutely nothing to do with the original topic. Delightfully hijacked.
Yes, I had noticed that as well - beautifully done, everyone! ;-)
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>>> Again, welcome to the real world. There are assholes out there. Best
>>> way of dealing with them is to ignore them.
>> That still doesn't explain why I'm the only one having this problem.
> You aren't the only one in the entire world having this problem.
No, but I *am* the only person on the Haskell mailing list having this
problem.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid XP v8 wrote:
>
> No, but I *am* the only person on the Haskell mailing list having this
> problem.
>
Can you say "Clique?" Good! I knew you could!
--
~Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> No, but I *am* the only person on the Haskell mailing list having this
>> problem.
>
> Can you say "Clique?" Good! I knew you could!
Uh... I realise this is probably orthoganol to the point you were trying
to make, but... actually no, I can't. I have no idea what that means.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |