You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/12/18 21:43:29 UTC

DO NOT REPLY [Bug 15503] New: - RefHashTableOf has poor performance due to constant table size

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15503>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15503

RefHashTableOf has poor performance due to constant table size

           Summary: RefHashTableOf has poor performance due to constant
                    table size
           Product: Xerces-C++
           Version: Nightly build (please specify the date)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Utilities
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: ncodding@pureedge.com


We need to attach user data to nearly every node in a Xerces DOM in our 
application. In doing so, I started to notice bad performance in 
SetUserData/GetUserData. User data for every node is stored in a RefHashTableOf 
on the Document that is initialized to size 29. 

RefHashTableOf, however, does not ever increase the size of its table when the 
number of element gets big. In our case, with a relatively average 30,000 node 
document, the best case (i.e. even distribution in the hashtable) is that every 
GetUserData call traverses a 1,000-element linked list. This is rather slow. :)

The solution is for RefHashTable to maintain a load factor by increasing table 
size when needed. I have attached a patch to accomplish exactly that.

The results: in our application, we now spend less than 20% as much time doing 
GetUserData/SetUserData as we used to, and a nice overall performance win.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org