From: "Michael T. Richter" Date: 2008-07-20T11:24:08+09:00 Subject: Re: JRuby performance questions answered --=-Caq7b0YvqFywKlbxVNCg Content-Type: text/plain Content-Transfer-Encoding: 7bit On Sun, 2008-07-20 at 09:43 +0900, Roger Pack wrote: > This is somewhat confusing for me, because it seems that using a mark > and sweep generational style GC slows down Ruby, as per > > Matz's observations: http://www.ruby-forum.com/topic/123747 Badly-written garbage collection slows things down. This is no surprise. Badly written string handling or maths handling slows things down too. > On my own I tried integrating Boehm's GC as a drop in replacement and it > seemed to cause a serious slowdown [possibly because I didn't integrate > it right :P ] Whereas I snuck Boehm's GC into an employer's product (to find memory leaks, initially, but later just kept it in as a memory manager) and nobody noticed it until long after it was released. Nobody noticed because it actually improved performance in that persistent memory leaks vanished and as a result swapping was reduced (among other memory-related bottlenecks). Of course then the retards removed the GC because "garbage collection is slow" and the next release after that died a horrible death of a million paper cuts (read: memory leaks). > I suppose I'm just naive, but it doesn't seem clear to me which is the > 'best' GC style, from the above observations. There appears to be no > clear answer. And from here true wisdom grows. Pick up Richard Jones' book (ISBN 0-471-94148-4) or drop by his web page (http://www.cs.kent.ac.uk/people/staff/rej/gc.html) and read. There is no single silver bullet for memory management. You have to pick and choose your algorithms and implementations based on your memory use profile. The reason proper garbage collection has the reputation of being slow is because the people who put it into their programs rarely understand the domain, and the reason they rarely understand the domain is because most people dismiss GC as slow which leads into a tight spiral of memory-managed death. -- Michael T. Richter (GoogleTalk: ttmrichter@gmail.com) Politics is the art of looking for trouble, finding it whether it exists or not, diagnosing it incorrectly, and applying the wrong remedy. (Ernest Benn) --=-Caq7b0YvqFywKlbxVNCg--