Linked by ebasconp on Fri 10th Jun 2011 22:22 UTC
Benchmarks "Google has released a research paper that suggests C++ is the best-performing programming language in the market. The internet giant implemented a compact algorithm in four languages - C++, Java, Scala and its own programming language Go - and then benchmarked results to find 'factors of difference'."
Thread beginning with comment 476929
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[4]: GCC isn't all that great
by Neolander on Sat 11th Jun 2011 10:15 UTC in reply to "RE[3]: GCC isn't all that great"
Neolander
Member since:
2010-03-08

I'd argue that the C/C++ developer shouldn't have to do black magic in order to optimize its code either.

Alfman's use of for loops is perfectly normal, easy to understand, and you'll find it in every book on C. One shouldn't have to sacrifice code clarity like you did in order to get better performance, especially on such trivial code.

Reply Parent Score: 2

acobar Member since:
2005-11-15

Sorry, but I fail to find where the code I showed is "less understandable". It is actually a very well known technique, i.e., reduce the number of unneeded comparisons.

Anyway, it was used only to point out one of the many gross assumptions people do about code efficiency, compiler optimizations and related stuff. We clearly should teach more about algorithms than about languages like we do today.

Reply Parent Score: 2

Neolander Member since:
2010-03-08

Sorry, but I fail to find where the code I showed is "less understandable". It is actually a very well known technique, i.e., reduce the number of unneeded comparisons.

I was thinking about how you used trigraphs and put the loop's iterator inside of the loop's body instead of putting it within the for() itself.

Anyway, it was used only to point out one of the many gross assumptions people do about code efficiency, compiler optimizations and related stuff. We clearly should teach more about algorithms than about languages like we do today.

But then wouldn't there be a feeling among both students and their future employers that they have learned lots of pretty theory, but not how to actually do things in practice ?

Also, is there such a thing as a language-independent algorithm ? Different languages have very different ways of expressing things, and algorithmic course generally teach students about an imperative algorithmic language pretty close to the structure of Pascal and C.

Edited 2011-06-11 11:00 UTC

Reply Parent Score: 1

Carewolf Member since:
2005-09-08

If you are not a wizard you should not be programming C/C++. There are other languages that are much better suited for high-level programming. C/C++ are only superior languages in enabling more power to a powerful wizard, in unskilled hands they are at best teaching/testing tools.

Reply Parent Score: 2

Neolander Member since:
2010-03-08

Yup, but you can do low-level programming (which makes the use of HLLs much harder, even though some projects like MS Singularity try to use them anyway) and still wish you didn't have to care about the internals of the compiler's optimizer and to do compiler-specific wizardry in order to optimize your code.

Edited 2011-06-13 11:08 UTC

Reply Parent Score: 1