On Tuesday 08 November 2005 04:41 pm, Andre Truter wrote:
On 11/8/05, Allen
wrote: The fact is actually that one cannot really say that the one language is faster than the other, becuase the speed all depends on the implementation and what you want to do.
A myth usually shown false with a little assembler.
OK, I'll agree that something written in assembler is about always faster that written in any other language, but someone can also write a program in assembler that will be slower than the same program written in C. The assembler version would then be written very bad. That is my point here.
It's been several years since I studied this at the microcode control level, but I can only imagine compilers have extended this technology. Compilers can ofther analyse the call sequence and find ways of interleaving and prefetching that a human being would have a very hard time competing with. Sure, there are tweeks a person with a profiler can implement with in-line assembly calls, but other than very specialized, and fairly limited cases, it is unlikely assembler is going to provide much if any performance increase. GCC 4.x introduced some impressive performance increases. It you know what you are doing with CPP, you can write your code in a way that doesn't even involve pointers. References are not pointers, and do not incur the same dereferencing hit pointers do.
If you compare compilers and languages you generally implement the exact same program in them all and you try to do the best implementation in each language and compile with best options. Then, assembler will be afstest and C will be faster than C++.
C has nothing significant in the way of performance which C++ lacks. OTOH, C++ has several features which can enhance performance if used correctly. Quit often C programmers with implement solutions which are structured in many way like C++.
But to compare somthing like GNOME and KDE and say that one is faster than the other becuase of the language used is not valid, because they are two different things, with two different designs consisting of hundreds of applications. There are too many variables that affect the speed.
For the record I never stated that the KDE would be faster than the GNOME just because it is written in C++. What I said what that C++ can, in principle, be used in ways that improve performance which C would have a hard time emulating.
People complain that when they install GNOME with rpms that it has dependency problems. Installing from source is a totally different story.
I've been down that road too.