|
Unneeded hashtable in LazyHTMLDocument: msg#00032java.enhydra.xmlc
Currently in LazyHTMLDocument, which is currently using a Hashtable, the createElement method will block on the _elementConstHTML.get() call, since hashtables are synchronized. Since the map is read-only after it is created, it should be slightly faster to use a HashMap, as long as you are careful not to access the map before it is finished being created. The following diff should accomplish this, and offer at least a slight performance boost in multithreaded situations. This diff corrects a problem in my previous submission to this list, in that the map now can't be accessed until it is completely initialized. Mark Leverentz Index: LazyHTMLDocument.java =================================================================== RCS file: /cvsroot/xmlc/xmlc/xmlc/modules/xmlc/src/org/enhydra/xml/lazydom/html/LazyHTMLDocument.java,v retrieving revision 1.2 diff -b -r1.2 LazyHTMLDocument.java 92c92 < --- > import org.enhydra.apache.html.dom.*; 180,181c180,181 < private static Hashtable _elementConstHTML; < --- > private static HashMap _elementConstHTML; > private static HashMap _tmpElementConstHTML; 612c612 < _elementConstHTML = new Hashtable( 63 ); --- > _tmpElementConstHTML = new HashMap( 63 ); 675a676 > _elementConstHTML = _tmpElementConstHTML; 679c680 < private static void populateElementType( String tagName, String className ) --- > private static void populateElementType(String tagName, String className ) 683c684 < _elementConstHTML.put( tagName, cl.getConstructor( _elemClassSigHTML )); --- > _tmpElementConstHTML.put( tagName, cl.getConstructor( > _elemClassSigHTML ));
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: How to supress the *.java.optionCheck files?, David Li |
|---|---|
| Next by Date: | Re: How to supress the *.java.optionCheck files?, Thorsten Möller |
| Previous by Thread: | How to supress the *.java.optionCheck files?, Boris Klug |
| Next by Thread: | Re: Unneeded hashtable in LazyHTMLDocument, Jacob Kjome |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |