Return-Path: Delivered-To: apmail-xerces-j-dev-archive@www.apache.org Received: (qmail 42437 invoked from network); 9 Jan 2008 13:46:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jan 2008 13:46:20 -0000 Received: (qmail 92332 invoked by uid 500); 9 Jan 2008 13:46:00 -0000 Delivered-To: apmail-xerces-j-dev-archive@xerces.apache.org Received: (qmail 92265 invoked by uid 500); 9 Jan 2008 13:46:00 -0000 Mailing-List: contact j-dev-help@xerces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: j-dev@xerces.apache.org Delivered-To: mailing list j-dev@xerces.apache.org Delivered-To: moderator for j-dev@xerces.apache.org Received: (qmail 1926 invoked by uid 99); 9 Jan 2008 06:01:15 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Message-ID: <036901c85285$069adec0$6501a8c0@MeBigFatGuy> From: "Dave Brosius" To: References: Subject: Re: Interning strategy Date: Wed, 9 Jan 2008 01:01:06 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Virus-Checked: Checked by ClamAV on apache.org Greetings, i was purusing old mailing list emails, and stumbled onto the following email sent some time ago :) Luckily, from a quick perusal of the code, it appears that the email still applies. I have a question about the implementation of SymbolTable As expected, it appears to me to that it does hashing to find a bucket, then walks the chain of pointers from the bucket to find a string that is 'equals' Only if it doesn't exist is a new one added. All of this makes sense. The question i have then, is why when you add an entry public Entry(String symbol, Entry next) { this.symbol = symbol.intern(); characters = new char[symbol.length()]; symbol.getChars(0, characters.length, characters, 0); this.next = next; } does the code intern the string? Isn't the point of this class to stop pollution of the constant pool and perm gen? (besides allowing for alternate hashing?) Given that the one String that lives in the SymbolTable is returned, i would think intern is redundant. thanks, dave ----- Original Message ----- From: "Michael Glavassevich" To: Sent: Sunday, July 24, 2005 11:57 AM Subject: Re: Interning strategy Elliotte Harold wrote on 07/22/2005 09:35:02 PM: > Suppose I turn on interning in the parser by setting the SAX property > http://xml.org/sax/features/string-interning to true. Will Xerces simply > invoke the String.intern() method on the strings it creates or does it > do something fancier like maintaining its own pool of string constants > and reuse those? It maintains a pool. See org.apache.xerces.util.SymbolTable, specifically the addSymbol() methods. > -- > Elliotte Rusty Harold elharo@metalab.unc.edu > XML in a Nutshell 3rd Edition Just Published! > http://www.cafeconleche.org/books/xian3/ > http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org > For additional commands, e-mail: j-dev-help@xerces.apache.org > Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrglavas@ca.ibm.com E-mail: mrglavas@apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org For additional commands, e-mail: j-dev-help@xerces.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org For additional commands, e-mail: j-dev-help@xerces.apache.org