Linked by Thom Holwerda on Sun 20th Apr 2008 15:43 UTC
General Development Geek.com is running an opinion piece on the extensive reliance of programmers today on languages like Java and .NET. The author lambastes the performance penalties that are associated with running code inside virtualised environments, like Java's and .NET's. "It increases the compute burden on the CPU because in order to do something that should only require 1 million instructions (note that on modern CPUs 1 million instructions executes in about one two-thousandths (1/2000) of a second) now takes 200 million instructions. Literally. And while 200 million instructions can execute in about 1/10th of a second, it is still that much slower." The author poses an interesting challenge at the end of his piece - a challenge most OSNews readers will have already taken on. Note: Please note that many OSNews items now have a "read more" where the article in question is discussed in more detail.
Thread beginning with comment 310613
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: He's making the wrong point
by dagw on Sun 20th Apr 2008 22:06 UTC in reply to "He's making the wrong point"
dagw
Member since:
2005-07-06

Without wishing to start a flame war, it's simply not true that C++ is slower than C.


Agreed. However C++ gives you many more options for shooting yourself in the foot and producing very slow code if you don't know what you're doing. So while it's certainly possible to write C++ code that is as fast as C, it isn't necessarily easy.

Reply Parent Score: 8

gilboa Member since:
2005-07-06

Agreed. However C++ gives you many more options for shooting yourself in the foot and producing very slow code if you don't know what you're doing. So while it's certainly possible to write C++ code that is as fast as C, it isn't necessarily easy.


... I call such code C-Plus-Minus.
C code rewritten in C++ with minimal mocking around. (No virtual functions, overloading, etc)

- Gilboa

Reply Parent Score: 2

dagw Member since:
2005-07-06

... I call such code C-Plus-Minus.
C code rewritten in C++ with minimal mocking around. (No virtual functions, overloading, etc)


The exact opposite approach can cause just as much performance problems, if not more. Things like creating a class when you could use a simple varible (I've seen plenty of classes which where essentially a complicated wrapper around a double), and then using dynamically allocated stl vectors containing members of that class when a statically allocated array of doubles would have worked just as well.

Admittedly many of these things can in many cases be defended as "good design" in some sense, and as such aren't always a bad idea. However you have to be aware that all these things come with a performance penalty. So you have to balance the good with the bad. One of the advantages with C++ is that you have this choice.

The problem is people hear unqualified statements like "C++ is just as fast as C" and think that any C++ code they write will always be 'fast' simply because C is 'fast'.

Reply Parent Score: 2