Language for ultimate speed

The programming language for ultimate speed

  • C

    Votes: 12 33.3%
  • C++

    Votes: 15 41.7%
  • Fortran

    Votes: 5 13.9%
  • C#

    Votes: 4 11.1%
  • Java

    Votes: 0 0.0%

  • Total voters
    36
  • Poll closed .

rpg.314

Veteran
When speed (of execution) matters over everything else, which programming language would you recommend?

Assembly specifically excluded.

EDIT: Speed of ????? clarified.
 
Last edited by a moderator:
Fortran is there because it is often the language of choice in HPC.

Java and C# are there for some harmless fun. :)
 
Hasn't this already been analyzed before? I seem to remember it being C, then C++, etc.

I voted for C# because it's easy to use, a lot of people (on the Internet) seem to hate it, and I like pissing those people off.:)
 
Last edited by a moderator:
A while back I took a course in numerical programming with C++, you can find the slides and all here, and one of the first things we were told was that if we were to be working on very large datasets, we should port the most computational intensive parts to Fortran 77 and do the rest in C/C++.
You find some of the arguments under the "Efficiency; C++ vs. F77" chapter.

Outside of those very large datasets, I think the difference between doing it in C or F77 should be rather small, and I'd stick with C as I know that best...

What are you collecting the data for?
 
When speed matters over everything else, which programming language would you recommend?

You can write fast code in several of those languages, and slow code in all of them. Certainly between C and F77 I'd say the difference would most likely be in the programmer not the language.
 
Even speed of execution is vague. Local, remote, distributed, data-heavy, computation-heavy, etc. are all variables (excuse the pun) that affect one language or the other. Certainly, C is the fastest as it is a macro-assembler. Nowadays I wouldn't be caught dead using it though.

I'm with NRP, with C# time you save coding your priority modules is time spent on adding new features, improving performance, or getting rid of bugs. I'm also taking a closer look at F# for large sea-of-processors type apps.
 
I voted C++ because you can write C-like code in C++ anyway, so I don't see the point of ever chosing plain C over C++.
 
One of the slowest languages is english
heres my code

Code:
 Oi Humus how about a Fireworks Screensaver

6 months later and i'm still waiting :(
 
Since people seem to be voting so far for C over C++, I want to ask which parts of C++ make it unfavourable compared to c++. For the rest you can assume that the execution is on a single machine only. (no distributed, remote business here)
 
Some people may be thinking about the dynamic binding features in C++, which is slower in general. However, I think if one wants to write a very fast C++ program, s/he is likely to be using templates, which is basically a very powerful macro compared to anything C offers. I think it's possible in this sense for C++ to be faster than C.
 
Yeah, no assembly. After 5 decades of compiled languages, the case for assembly should be only in kernels to manage cpu specific code. I am a bit biased but yes, assembly scares me somewhat.
 
It 100% depends on what you're trying to write... frankly if you can express something efficiently in a super-simple language like a shading language (HLSL for instance) it'll easily be the fastest since compilers/optimizers can be hyper-aggressive due to the rules of the language.

But for practical general-purpose, single-threaded stuff I'd say C/C++, although Fortran has some advantages over them in terms of aliasing analysis (hell even Matlab can occasionally compile more optimal code than a similar implementation in C/C++ due to using much saner aliasing rules and value semantics). Fundamentally the aliasing rules in C/C++ are going to screw it over (and have already started to) in the parallel programming world, but it's still the best we have for now since the compilers are so mature.
 
But for practical general-purpose, single-threaded stuff I'd say C/C++, although Fortran has some advantages over them in terms of aliasing analysis (hell even Matlab can occasionally compile more optimal code than a similar implementation in C/C++ due to using much saner aliasing rules and value semantics). Fundamentally the aliasing rules in C/C++ are going to screw it over (and have already started to) in the parallel programming world, but it's still the best we have for now since the compilers are so mature.
Yes, there was an interesting and very long thread on the "Game Developers Algorithms" mailing list on this very subject, for example:
Jim Tilander said:
Now some people question the need to actually bother with stuff like this, and continue on casting like we programmed in C89. They will get bitten by the decent compilers that does perform the most basic optimizations. They will be very slow on in-order processor by nature of the compiler having no chance to figure out aliasing. Aliasing btw is the big reason why FORTRAN is 2x as fast as regular C89 in most of the cases. Aliasing a large reason why C99 came about and why C++ has the draconian rule 3.10.15. There is a *reason* why this all matters and that is speed.
 
Thanks for the link, Simon.

Strict aliasing and in a few cases "restrict" help, but they do not solve the fundamental language problem... they reduce it somewhat (particularly the catastrophically stupid compiler cases), but they don't fix it completely. I'm just becoming more and more depressed with the prospect of how much we'd have to bolt on/change C/C++ to make it usable and efficient in a massively (data) parallel world, but we'll see what people come up with.
 
Last edited by a moderator:
Back
Top