You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Joerg Henne <jo...@cogito.de> on 2000/10/22 15:08:02 UTC

[patch] Proposal for more efficient HTMLdtd

Hi all,

while profiling some test cases under Cocoon2 I noticed, that a huge number of
temporary String objects are created during serialization with the
org.apache.xml.serialize API. I tracked this down to HTMLdtd.fromChar() where
String.valueOf() is called for every single character in order to use the
result for a (single!) hashtable lookup.
To overcome this large number of object creations which accounts for the
majority of temporary object creations during a typical Cocoon processing
cycle and for roughly 8% of CPU time (plus GC overhead!), I propose the
following patch, which you'll find attached. This patch uses a sorted vector
of char value to entity name mappings and a simple binary search for the
lookup. 

Joerg Henne