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 310722
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: He's making the wrong point
by gilboa on Mon 21st Apr 2008 15:02 UTC in reply to "RE: He's making the wrong point"
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

gilboa Member since:
2005-07-06

I fully agree.
I work in a hybrid C/C++ group.
Kernel code and OS abstraction libraries are written in C while service wrappers and the actual applications are written in C++.

AFAICS OO seems to be drawing (good) programmers into a lot of data management and packaging games - read: a trivial pass-a-structure-pointer throughout your code (in C) problems - tend to turn into a nasty (and slow) data packaging and repackaging problem. (in CPP).

In our CPP developer's defense, they are very performance conscious and rarely wrap a single boolean variable with a 1000 line long class. (Hence, large chunks of their code is C-Plus-Minus).

... Just don't get me started about .NET/C#. (Other groups are using it; performance is horrible; switching back to CPP...)

- Gilboa

Reply Parent Score: 2