Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 62188 invoked from network); 25 Jan 2007 13:45:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jan 2007 13:45:08 -0000 Received: (qmail 36508 invoked by uid 500); 25 Jan 2007 13:45:12 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 36427 invoked by uid 500); 25 Jan 2007 13:45:12 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 36416 invoked by uid 99); 25 Jan 2007 13:45:12 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jan 2007 05:45:12 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [68.230.240.34] (HELO eastrmmtao05.cox.net) (68.230.240.34) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jan 2007 05:45:03 -0800 Received: from eastrmimpo01.cox.net ([68.1.16.119]) by eastrmmtao05.cox.net (InterMail vM.6.01.06.03 201-2131-130-104-20060516) with ESMTP id <20070125134441.FPLU4144.eastrmmtao05.cox.net@eastrmimpo01.cox.net> for ; Thu, 25 Jan 2007 08:44:41 -0500 Received: from [192.168.0.100] ([24.255.120.190]) by eastrmimpo01.cox.net with bizsmtp id FRkg1W00u46aSr40000000; Thu, 25 Jan 2007 08:44:41 -0500 Message-ID: <45B8B438.8010707@reverycodes.com> Date: Thu, 25 Jan 2007 08:44:24 -0500 From: Vadim Gritsenko User-Agent: Thunderbird 1.5.0.9 (Macintosh/20061207) MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Object pooling considered harmful References: <459AD722.6090304@nada.kth.se> In-Reply-To: <459AD722.6090304@nada.kth.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Daniel Fagerstrom wrote: > What is this object pooling about? Once, long time ago, Java was really > slow in creating and destroying objects ... > > Now with modern JVMs (1.2 and later), things has changed dramatically. > Creation and destruction of objects is amazingly fast. A "new Object()" > is about 10 machine instructions ... In Cocoon pooling was mostly for (relatively heavy) sitemap components. Problem is not memory allocation (new FooGenerator()) - this is the fastest part - problem lies in component lifecycle. If you combine costs of instance initialization, contextualization, configuration, setting service manager for a component, you'd arrive to much greater number. Granted, some of the sitemap components are trivial to create (e.g: StripNamespacesTransformer), but some others might take ages. There is no "one size fits all" solution, I'm afraid. If pooling is dropped completely, heavier sitemap components would have to be split up into "back end" components doing heavy lifting and "front end" components with simplified lifecycle. I18nTransformer could be thought of as an example of this pattern. It won't help though "mid-weight" components, whose fat is mostly located in the configure() method. Vadim