User: Password:
|
|
Subscribe / Log in / New account

The metric is SPEED not just easier development

The metric is SPEED not just easier development

Posted Mar 27, 2008 10:03 UTC (Thu) by khim (subscriber, #9252)
In reply to: yet another +5 by wahern
Parent article: Striking gold in binutils

If the metric is easier development because the language provides more sugar for certain patterns, how do you justify not using Java or C#?

Java and C# are using virtual machines and thus are slower. End of story. C is closer to the metal, but suffers from human problem: it's not feasible to generate 10'000 specialization by hand. You need some metaprogramming. If you'll take a look on really fast "C libraries" (like FFTW or ATLAS) you'll find out that while they include bunch of .c files these .c files are not the source! They itself are generated by some automatic process. C++ allows you to do something similar without using yet-another-specialized system (STL and especially boost are big help, but simple template metaprogramming works as well in simple cases). Thus in practice C++ programs written by good programmers are faster then C programs (if you turn of rtti and exceptions, of course). AFAICS this was reason for C++ usage in gold, too.

Of course it's very easy to misuse C++, too...


(Log in to post comments)

The metric is SPEED not just easier development

Posted Mar 27, 2008 10:56 UTC (Thu) by nix (subscriber, #2304) [Link]

One point: RTTI and exception handling don't slow down C++ programs anymore, except if
dynamic_cast<> is used or exceptions are thrown, and those are things which if you implemented
them yourself you'd have a lot of trouble making as efficient as the compiler's implementation
(I doubt that you *can* make them as efficient or reliable without compiler support).

Since WHEN?

Posted Mar 28, 2008 9:26 UTC (Fri) by khim (subscriber, #9252) [Link]

Last time we've checked (GCC 4.1.x) removal -fnortti and/or -fnoexceptions made real world programs 5-10% slower (up to 15% combined). What change happened in GCC 4.2 and/or GCC 4.3???

If you DO need RTTI and/or exceptions of course it's better to use compiler-provided ones, then to write your own, but if not... For things like gold abort() is perfectly usable alternative to the exceptions...

Since WHEN?

Posted Mar 28, 2008 21:26 UTC (Fri) by nix (subscriber, #2304) [Link]

I think I need to profile this, then, because exception frames should be 
very nearly free to set up and (non-throw) tear down, certainly not as 
expensive as 15%. This wasn't on an sjlj target, was it? 'cos they're *so* 
last millennium.

The metric is SPEED not just easier development

Posted Apr 2, 2008 11:12 UTC (Wed) by dvdeug (subscriber, #10998) [Link]

Java the programming language doesn't use a virtual machine any more than C does. It happens
to usually be implemented using a virtual machine, but there are native compilers, like gcj.
Furthermore, the coding matters a lot more than the language, and the language can frequently
simplify the coding.


Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds