Return-Path: Delivered-To: apmail-incubator-empire-db-dev-archive@minotaur.apache.org Received: (qmail 15988 invoked from network); 29 Nov 2009 12:32:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Nov 2009 12:32:17 -0000 Received: (qmail 57390 invoked by uid 500); 29 Nov 2009 12:32:17 -0000 Delivered-To: apmail-incubator-empire-db-dev-archive@incubator.apache.org Received: (qmail 57363 invoked by uid 500); 29 Nov 2009 12:32:17 -0000 Mailing-List: contact empire-db-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: empire-db-dev@incubator.apache.org Delivered-To: mailing list empire-db-dev@incubator.apache.org Received: (qmail 57353 invoked by uid 99); 29 Nov 2009 12:32:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Nov 2009 12:32:17 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [88.79.172.157] (HELO mail.esteam.de) (88.79.172.157) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Nov 2009 12:32:15 +0000 Content-class: urn:content-classes:message Subject: re: Why ArrayList with Unknown Result Count? Date: Sun, 29 Nov 2009 13:31:52 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-ID: In-Reply-To: <641331.35745.qm@web50606.mail.re2.yahoo.com> X-MimeOLE: Produced By Microsoft Exchange V6.5 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: re: Why ArrayList with Unknown Result Count? thread-index: Acpw4tDRnkHvtRaUTYulD7bGaAnZBQADC3+w References: <641331.35745.qm@web50606.mail.re2.yahoo.com> From: =?iso-8859-1?Q?Rainer_D=F6bele?= To: Hi Amin, these functions are provided for convenience only and are indeed = intended for small result sets. For special needs people can implement their own function - in fact they = should use a DBReader. But what we could easily do, is to provide an overload for those = functions that allow to supply the collection. Hence the use can decide = which collection to use. I will create an JIRA issue for this too. Thanks again Rainer Amin Abbaspour wrote: > re: Why ArrayList with Unknown Result Count? >=20 > Hello everyone, >=20 > This is my first email in empire-db's developers mailing list :) First > of all thanks for your ideas and attempts. >=20 > I was reading source code and noticed that ArrayList is used to store > results in querySimpleList and queryObjectList and also to hold values > in tables, relations, and views. >=20 > While the second usage (for tables, relations, etc) is not much > critical since they are limited in size, IMHO using ArrayList without > initial size is prohibited for large datasets such as those returned = by > queries. As you all know this will result in many times memory > allocation and collection since it goes from size 10 -> 20 -> 40 -> > etc. >=20 > I recommend that in the cases that there is a known return value count > (like selectSingle or select with Limit value), ArrayList should be > used with initial size in constructor; otherwise LinkedList is a = better > choice. >=20 > Regards, > Amin Abbaspour >=20 >=20 >=20 >=20