Subj : Re: OO compilers and efficiency To : comp.programming From : Rob Thorpe Date : Wed Jul 20 2005 04:47 am Chris Dollin wrote: > 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. I would say that it is C, since the GC doesn't change the meaning of the language, it's just a library albeit an elaborate one. But that's only a minor difference in point-of-view. My main point was that GC is not tied to OO, or vice versa. .