Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 89745 invoked by uid 500); 18 Jan 2002 14:26:43 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 89734 invoked from network); 18 Jan 2002 14:26:42 -0000 From: "Piroumian, Konstantin" To: cocoon-dev@xml.apache.org Message-ID: <00e701c1a02c$24903400$6150000a@flagship.ru> References: <3C47440D.40609@apache.org> <3C47EAA5.3000808@anyware-tech.com> <002d01c1a01d$affaceb0$6150000a@flagship.ru> <3C482D1A.5040607@apache.org> Subject: Re: [Heads Up] Utility for efficiency Date: Fri, 18 Jan 2002 17:26:39 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Sylvain, Berin, you are very convincing ;) I told that only because just yesterday have read about it in Bruce Eckel's "Thinking in Java 2nd Edition" (Appendix C, Implementation section, 14). It sounds something like (have read it in Russian and will try to translate it back to English): 14. ... Use containers from standart Java libs. Becoming more professional in container usage, you will also improve your perfomance. Prefer to use ArrayList for sequences, HashSet for sets, HashMap for associated arrays and LinkedList for stacks (instead of Stack) and queries. Konstantin > Piroumian, Konstantin wrote: > > >>Berin Loritsch wrote: > >> > >> > > > > > > > >>Buffers are really great for FIFO (first in, first out). > >> > >>For LIFO (last in, first out), the JDK offers java.util.Stack, but its > >>use should avoided since it is synchronized. There's an unsynchronized > >>replacement in org.apache.avalon.excalibur.collections.ArrayStack. > >> > >> > > > > Why not use java.util.LinkedList instead of java.util.Stack? > > > You obviously didn't look at the performance figures. > > LinkedList is the most inneficient class, and you have to have a large number > of objects in that list to make it more efficient than ArrayList. It is > still far less efficient than even Stack. I will throw together a quick > test to prove that point--but we should never be dealing with lists long > enough to make LinkedList even remotely considerable. > > > > > > -- > > "They that give up essential liberty to obtain a little temporary safety > deserve neither liberty nor safety." > - Benjamin Franklin > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org > For additional commands, email: cocoon-dev-help@xml.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org