Look, I love C++ and I'd love to say look I told you all, C++ is the fastest, but frankly it just doesn't work like that. When we come to a point where every programmer writes the fastest possible code their language could create then we have some kind of a comparison.
C++ has a philosophy that you don't pay for what you don't use, but there is not a single construct in C++ that can't be built in C with enough code (virtual functions are a grey area since the compiler can better optimizer them over direct function pointers... but that is irrelevant anyway). Sometimes the amount of code is rediculous and frequently to obtain the same speeds one has to sacrifice portability and reusability. In theory, and ONLY in theory, assembly is the fastest programming language. The fact is, in a sufficiently complex program, there will always be parts of the program left to further optimize. I would assert that for a complex program, an assembly programmer and a C++ programmer both writing the same program and spending the same amount of time will leave the assembly version slower always. It is not because assembly is a slower language, it is because if the assembly guy spends another 1000 hours optimizing, so will the C++ guy and certainly their are exceptions, but in general, for most problems and for reasonable amounts of time spent, the C++ code will be faster. C++ is "faster" than C because the STL (and other generic code) allows the programmer to spend their precious time optimizing the bottleneck and using a very fast default for less critical places. For a sufficiently small program however I will wager that given enough time, C will be exactly the same speed as C++ if the programmers involved are both good. When will you people learn the limits of benchmarks? They are only useful for showing how worthless Java is... nothing else. Got it? - Nick On Dec 15, 2007 2:44 AM, Darren Cook <[EMAIL PROTECTED]> wrote: > >> I thinks it's very difficult to outperform C since C really is just > >> about at the level of assembly language. > > > > No, in special cases it's not that hard to outperform C, because the > > language spec dictates some not so efficient details. C has an ABI and > > it's specification is optimized for the general case. > > Stefan, judging by this site (which I posted some links from yesterday) > your intuition is correct: > http://shootout.alioth.debian.org/ > > Overall C comes in 2nd, 10% slower than C++ (due to extra hints to the > compiler I assume). But C/C++ are not the top of every benchmark. E.g. > http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&lang=all > > Darren > > > -- > Darren Cook > http://dcook.org/mlsn/ (English-Japanese-German-Chinese free dictionary) > http://dcook.org/work/ (About me and my work) > http://dcook.org/work/charts/ (My flash charting demos) > _______________________________________________ > computer-go mailing list > computer-go@computer-go.org > http://www.computer-go.org/mailman/listinfo/computer-go/ >
_______________________________________________ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/