Subj : Re: OO compilers and efficiency To : comp.programming From : Chris Dollin Date : Wed Jul 20 2005 11:49 am Rob Thorpe wrote: > Chris Dollin wrote: >> Brian wrote: >> > Anyway, those are some of the things that kind of nag at me. >> > I think it's a safe statement to say C can beat any OO compiled >> > program pound for pound given the same programmer skill and >> > adherence to language goals. >> >> There are so many assumptions buried there that I can only >> mention a few. >> >> * OO languages typically [ie, Java] come with GC. C doesn't. >> This can make an enormous difference to the simplicity of OO >> code. That means that OO programs can tackle larger problems >> with the same-ish amount of engineering effort - they can >> out-produce the C programmer before the code efficiency is >> an issue. (What the OO program loses in GC costs is roughly >> the same as what the C program loses in memory-management >> costs, eg copying.) > > I think your other reasons are stronger than this one. Although C > doesn't come with a GC it's very simple to add one, you can download > the Boehm garbage collector and use it for example. If the C program wasn't written with GC in mind, randomly using the Boehm GC (and tweaking malloc/free) won't get you the advantages of a GCd language. If the C *was* written with GC in mind, then you're writing in a C-like GCd language with the usual benefits - assuming that you don't fall over any of the conservative GC assumtions. But that language isn't really C any more. > All the questions of efficiency depend on how important efficiency is. > When it is important you may have to reject a language or paradigm > because it can't give you the performance you need. When efficiency > isn't important you can pick and choose whatever language you think is > appropriate. Verily. -- Chris "electric hedgehog" Dollin It's called *extreme* programming, not *stupid* programming. .