Subj : Re: OO compilers and efficiency To : comp.programming From : Jon Harrop Date : Thu Jul 21 2005 04:07 pm Rob Thorpe wrote: > Objects in Java are heap allocated, no matter what they are. There are > no stack allocated objects as there are in C++. This means that the > heap must take on the roll filled by both the stack and heap in other > languages. This means the garbage-collector must waste time cleaning > up stuff that's gone out of scope that in other languages would be > dealt with by just moving the stack pointer. > > This means that compared to other languages with GC Java relies more on > it's garbage collector, No. I believe many other language implementations (e.g. ocamlopt) work in the same way but are much faster than Java. I think Java's poor performance is due to Java implementations failing to optimise common OO patterns. > and of course it has the extra overhead of GC unlike C++ and C. GC is often faster than manual allocation and deallocation so it isn't really fair to call it an "overhead". Indeed, I'd call manual allocation and deallocation an overhead... -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com .